Forum Discussion
Anonymous
9 years agoNot applicable
[SOLVED] Click events fired twice on Gear VR
Hello, I am having a strange problem since the latest Oculus/GearVR update (not sure which one it was :blush: ). When I click on a button in Editor it works as expected, same when running the app in dev mode on the phone. But when I put the phone into Gear VR, clicks/taps are executed twice. I tried debugging via Wi-Fi and adb printed debug text from the same function twice (looks like in different frames though). I am using OVRCameraRig, GazePointerRing (from sample framework) and OVRInputModule. Buttons are standard ones from Unity's UI.
I have two apps with this problem. One is made in Unity 5.4.2f2 (Oculus Utilities v1.9.0, OVRPlugin v1.8.0) and another in Unity 5.5.0f3 (Oculus Utilities v1.10.0, OVRPlugin v1.10.0).
I tried to run older version of the app made in Unity 5.4.2f2 and it has the same porblem. I know that it worked before.
Here is additional information on GearVR/Oculus software installed on the phone:
Samsung Galaxy S6, Android 6.0.1
I have two apps with this problem. One is made in Unity 5.4.2f2 (Oculus Utilities v1.9.0, OVRPlugin v1.8.0) and another in Unity 5.5.0f3 (Oculus Utilities v1.10.0, OVRPlugin v1.10.0).
I tried to run older version of the app made in Unity 5.4.2f2 and it has the same porblem. I know that it worked before.
Here is additional information on GearVR/Oculus software installed on the phone:
Samsung Galaxy S6, Android 6.0.1
Gear VR Service 2.6.41
Gear VR SetupWizard 2.3.20
Gear VR Shell 2.3.02
Gear VR System 1.1.05
Gear VR SetupWizard 2.3.20
Gear VR Shell 2.3.02
Gear VR System 1.1.05
Oculus 2.26.7
Oculus System Activities 1.11.0-45918658
Oculus System Driver 1.0.4.2-45411680
You can see the OVRInputModule settings in the image below. "Invert Swipe Y Axis" setting was added by me but it doesn't affect clicks. Any help appreciated!
Oculus System Activities 1.11.0-45918658
Oculus System Driver 1.0.4.2-45411680
You can see the OVRInputModule settings in the image below. "Invert Swipe Y Axis" setting was added by me but it doesn't affect clicks. Any help appreciated!
14 Replies
Replies have been turned off for this discussion
- summitgamesHonored GuestI have developing this for almost one and a half year.. they update new things and bring more problems that worked perfectly fine.. Its the same problem i am facing gets clicked twice on gear vr and swipe gets registers as click.
- Rogar303Honored GuestThis alternative solution allowed clicks and swipes to be independent, but with it OnDown and OnUp no longer worked:
Just set the gazeClickKey to Keycode.Space.var pressed = Input.GetKeyDown(gazeClickKey) || OVRInput.GetDown(joyPadClickButton);
var released = Input.GetKeyUp(gazeClickKey) || OVRInput.GetUp(joyPadClickButton);
if (pressed && released)
return PointerEventData.FramePressState.PressedAndReleased;
if (pressed)
return PointerEventData.FramePressState.Pressed;
if (released)
return PointerEventData.FramePressState.Released;
return PointerEventData.FramePressState.NotChanged; - BrainloginProtegeI honestly didn't know how to turn imperativity's advise into a solution, how not to use Input because even the OVR Input Module itself uses Input such as Input.GetMouseButtonDown. But if this just meant that we should not have the StandaloneInputModule component on EventSystem, I did not have that, I only had OVR Input Module, yet I had the same problem with the Gear VR touch input double registered. The alternative solutions suggested above fixed this but they didn't work with other control devices. Here is my replacement for GetGazeButtonState() that gets rid of the double firing with built-in touchpad AND works with both Gear VR controller's trigger input and third party game pads X button:
virtual protected PointerEventData.FramePressState GetGazeButtonState()
{
var pressed = Input.GetMouseButtonDown(0) || OVRInput.GetDown (OVRInput.RawButton.X, OVRInput.Controller.Active) || OVRInput.Get (OVRInput.Button.PrimaryIndexTrigger);
var released = Input.GetMouseButtonUp(0) || OVRInput.GetUp (OVRInput.RawButton.X, OVRInput.Controller.Active);
if (pressed && released)
return PointerEventData.FramePressState.PressedAndReleased;
if (pressed)
return PointerEventData.FramePressState.Pressed;
if (released)
return PointerEventData.FramePressState.Released;
return PointerEventData.FramePressState.NotChanged;
} - JBPrimeHonored GuestI also ran into this problem on Unity 2017.4.1f1 using the Oculus Integration package 1.24.0. The OVRInputModule was giving me two button clicks when I ran with GearVR on a Galaxy S6. It looked like it was getting the mouse button from Unity's Input, and then several frames later it got the touchpad controller button from OVRInput. Doing some further tracing, I got this sequence of events in OVRInputModule.GetGazeButtonState():
[Frame 50]: Input.GetMouseButtonDown() is true
[Frame 55]: Input.GetMouseButtonUp() is true
[Frame 56]: OVRInput.GetDown() is true
[Frame 57]: OVRInput.GetUp() is true
So I'd get a click event on frame 55 from the press/release sequence, and then another on frame 57 from the second press/release sequence. Further digging and I noticed that OVRManager.Update() was running after Unity's EventSystem update on a given frame, which meant that OVRInputModule was processing input from OVRInput that hadn't been updated for the current frame. So I changed the script execution order for OVRManager from -100 to -31122 (an arbitrarily large choice), and then OVRManager.Update() ran first, which pumped OVRInput.Update() and got all the button states correct for the frame before the Unity EventSystem updated.
This meant that Input.GetMouseButtonUp() and OVRInput.GetDown() were true on the same frame, which by the OVRInputModule logic meant I got a click event on that frame, but it did not start a new event sequence, and the OVRInput.GetUp() on the next frame did not trigger a second click event.
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 1 month ago
- 1 year ago