cancel
Showing results for 
Search instead for 
Did you mean: 

[SOLVED] Click events fired twice on Gear VR

Anonymous
Not applicable
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

Gear VR Service 2.6.41
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!

0ocwq7dr7o8d.png
14 REPLIES 14

Anonymous
Not applicable
I just wanted to add, that I created a new empty project in Unity 5.5.0f3 (Oculus Utilities v1.10.0, OVRPlugin v1.10.0). Same problem.

When I take the phone from Gear VR I can see a notification about disconnected mouse. Is this normal?

@imperativity
Thanks, I'll be patient 🙂

vrdaveb
Oculus Staff
when I put the phone into Gear VR, clicks/taps are executed twice.

Are you using OVRInput in addition to OVRInputModule? If so, you may want to skip your OVRInput-based code when the active controller is the touchpad:

if (OVRInput.GetActiveController() != OVRInput.Controller.Touchpad) { /* do input handling */ }
We recently added touchpad support to OVRInput and without the above check, you may get your gamepad button handling logic firing at unexpected times in addition to the usual touchpad handling code.

If you are really getting duplicate touchpad input, make sure you don't have two copies of components like OVRTouchpad or OVRInputModule in your scene.

Anonymous
Not applicable
@vrdaveb 
I'm using OVRInputModule only. I added the following code to print active device to the console:
Debug.Log(OVRInput.GetActiveController().ToString());
First click prints None and immedeatelly after it prints Touchpad. Every click after that prints Touchpad twice. Checking if there are multiple copies of components mentioned above was the first thing I did.

I made another empty project (Unity 5.5.0f3), imported Utilities 1.10 package and copied OVRHarness, OVRInspector and Parse folders from Oculus Sample Framework (1.5.1). I made an empty scene with OVRCameraRig, GazePointerRing and world space Canvas (with Graphic Raycaster disabled and OVRRaycaster enabled). EventSystem's standalone input module is disabled and OVRInputModule is enabled).

I set up player settings for VR and clicks worked as they should. I noticed that I forgot to set Android API level (it was set to 9 - Android 2.3.1). As soon as I changed API level, clicks started to get called twice. I tried to change API back to 9 and it didn't work anymore. Then I cleared data and cache on the phone and installed the app again. Clicks started to work again. But I can't replicate this again. It worked only once, no matter how many times I change API or delete data/cache. Uninstalling and reinstalling also doesn't help.

I updated Android SDK's, tools, platform tools, etc... It didn't help.

Anonymous
Not applicable
Hello, sorry for late reply. Yes, I still have this problem.

Anonymous
Not applicable
@imperativity
Okay, good to know.Thank you again for helping out!

Anonymous
Not applicable
Confirming that the issue has been resolved using the latest Oculus Utilities (1.12).

teliportme
Honored Guest
I'm Having the same issue now after upgrading to 5.6.0f3 with both Oculus Utilities 1.12 and 1,13. 

Rogar303
Honored Guest
I am having this issue as well in Unity 5.6.0f3, and Oculus Utilities 1.14. Regular UI Buttons are being clicked twice. All I have in my scene is the EventSystem with the OVRInputModule, a Canvas with the OVRRaycaster, and a Button in the canvas, and I can see that the button click is most often than not triggered twice. Might be worth noting that every time I swipe, instead of click in center of the Touchpad, the button click is triggered once. With that said, though, I don't expect a click when swiping so this is another issue I am having.

SerFreeman
Honored Guest
I had the same problem. I don't know what is official solution but you can try mine which works in my case.
Go to OVRInputModule.cs script and change this method.
virtual protected PointerEventData.FramePressState GetGazeButtonState()
{
//var pressed = Input.GetKeyDown(gazeClickKey) || OVRInput.GetDown(joyPadClickButton);
//var released = Input.GetKeyUp(gazeClickKey) || OVRInput.GetUp(joyPadClickButton);

//#if UNITY_ANDROID && !UNITY_EDITOR
// // On Gear VR the mouse button events correspond to touch pad events. We only use these as gaze pointer clicks
// // on Gear VR because on PC the mouse clicks are used for actual mouse pointer interactions.
// pressed |= Input.GetMouseButtonDown(0);
// released |= Input.GetMouseButtonUp(0);
//#endif
var pressed = Input.GetMouseButtonDown(0);
var released = Input.GetMouseButtonUp(0);

if (pressed && released)
return PointerEventData.FramePressState.PressedAndReleased;
if (pressed)
return PointerEventData.FramePressState.Pressed;
if (released)
return PointerEventData.FramePressState.Released;
return PointerEventData.FramePressState.NotChanged;
}