Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
Gullie667's avatar
Gullie667
Protege
10 years ago

Help with OVRInputModule and menus losing focus!

I have a scene set up using the OCULUS OVRInputModule as described here:

https://developer.oculus.com/blog/unity ... tem-in-vr/

In addition to that I have a separate gameobject that has an input controller that reads the B button (and others).

This allows for a control scheme that blends the gaze input method and a typical B = Previous menu functionality.

My issue is that when the B button is read from the other gameobject it is also stealing focus from the gazed at world space Canvas. The result is that the next press of the "Gaze Click Key" resigns focus to the menu and doesn't pass through to any of the UI Buttons on the Canvas and requires a second press to trigger the "On Click" of the UI Button.

Any ideas how to make this work correctly?

Thanks Much!

Gullie

4 Replies

Replies have been turned off for this discussion
  • The canvas shouldn't need focus in order to be able to click on buttons. The click should just "click-through" to the button giving focus and activating the button at the same time.

    What exactly does your other game object do? How does it detect the button presses?
  • Hey,

    I just ran through the oculus blog post as well and the input doesn't work with gamepad. I found what's wrong though, it's extremely small. Basically, the directions forget to say: "add an OVRGamepadController" to the EventSystem gameobject.

    There's a slight error with the directions listed here:
    https://developer.oculus.com/blog/unitys-ui-system-in-vr/

    The code works extremely well though, thanks guys, this is wicked! The directions are great too, just missing that one small thing. So, if you download the source code, grab the latest Oculus Unity Utilities, then open up the "VRPointers" scene, click on the EventSystem gameobject in the Hierarchy. You'll notice that it h as an OVRGamepadController component added. The directions don't say to add this and it causes no unhandled exceptions or anything, so it's a weird bug to try and fix. I even started adding breakpoints and scratched my head every time never getting bad results or different results from the spacebar.

    I followed the directions twice all the way through and got the same result, the gamepad doesn't work after you run through the directions, but the spacebar works fine and so does the mouse. However, I found that when I ran the "VRPointers" scene, the gamepad worked. So, I basically went through all of the gameobjects and compared what's different.

    Possible Unity bug I found too w/Oculus OVRCameraRig being utilized:
    While doing this, I found a very strange bug with unity. Can anyone reproduce this bug? I opened this project, added the required tools to make it run, ran it in VR Mode. Then, I opened another instance of Unity 5, opened a copy of the same project, tried to run in VR on the new instance, BAM, crashed unity. It happens for me every single time. The quickest way to get back going I found was to push the power button on the DK2, then Unity stops running and lets me close it normally and save. To actually get back into the HMD, I have to close all instances of unity, then re-open only one instance.

    I can have two instances open of unity just fine, but when I try to run on one, then the other, it crashes out. I am assuming here, but I am guessing it locks the DK2 to one instance, if you try to run it on the other instance, it's locked out. I just know now not to do that, maybe Unity doesn't think people will want to run multiple instances with VR? It sure would be handy if we could.

    I"m running Windows 10, Nvidia GTX 970, latest drivers, etc. Can anyone else confirm that bug?
  • Hey dignifiedweb, Thanks for pointing that out, I really appreciate it. I'm pushing a fixed version out now.
    Regarding your Unity crashing bug, I can't repro it myself. What's the latest version of Unity you can repro it on? Are you using version 0.8 of our runtime?
  • "andyborrel" wrote:
    Hey dignifiedweb, Thanks for pointing that out, I really appreciate it. I'm pushing a fixed version out now.
    Regarding your Unity crashing bug, I can't repro it myself. What's the latest version of Unity you can repro it on? Are you using version 0.8 of our runtime?


    No problem at all! I sort of long-winded explained it, but thank you most of all for the amazing source code to use.

    For the unity bug, I"m using the latest 0.8 runtime and Unity 5.3.0f4. Although, I suppose cyberreality suggests Unity 5.3.1p2. I guess that patch fixed the bug? No worries, it's a small bug anyways, it's easy to work around. Thanks again for the awesome tutorial! It's very nice!

    Any advice using the OVRInput in my project for referencing gamepad buttons on multiple devices? Is it all static reference variables? I should really look into it more before asking a question like that. I should be able to figure it out, no worries about getting into length about it if you don't have the time :)