cancel
Showing results for 
Search instead for 
Did you mean: 

OVRInput.GetUp not working correctly in Unity 2017.2 with GearVR Controller

GarrettSkye
Honored Guest
So, I seem to have encountered an issue in Unity 2017.2 with Oculus Utilities v 1.18.1. Calling OVRInput.GetUp(OVRInput.Button.PrimaryIndexTrigger) does not return true when releasing the trigger on a GearVR Controller. I wrote the following code to test this:
void Update () {
  if (OVRInput.GetDown(OVRInput.Button.PrimaryIndexTrigger))
        {
            r1.material.color = Color.red;
        }
        if (OVRInput.GetUp(OVRInput.Button.PrimaryIndexTrigger))
        {
            r1.material.color = Color.white;
        }
        if (OVRInput.GetDown(OVRInput.Button.PrimaryTouchpad))
        {
            r2.material.color = Color.red;
        }
        if (OVRInput.GetUp(OVRInput.Button.PrimaryTouchpad))
        {
            r2.material.color = Color.white;
        }
        if (OVRInput.GetDown(OVRInput.Button.Back))
        {
            r3.material.color = Color.red;
        }
        if (OVRInput.GetUp(OVRInput.Button.Back))
        {
            r3.material.color = Color.white;
        }
    }
The Primary Touchpad and Back button work appropriately when the GetUp and GetDown functions are called, and GetDown works with the Trigger, but GetUp is just not working. I tried this same code in 2017.1 and it works fine.
23 REPLIES 23

Rohirm
Honored Guest
I have same problem with GetDown, it doesn't work. Using Oculus Touch controllers with Unity 2017.1.1f1 and Oculus Utilities 1.18.1.

Edit. Nevermind, the problem was after importing project to newer Unity the Touch controller bind was missing from the hands.

mannixlo
Honored Guest
I got the same problem on OVRInput.GetDown(OVRInput.Button.Back) after I upgrade my project from Unity 2017.1.1f1 to 2017.2.0f3. Most of the time it doesn't work. i.e. It works randomly.

ichitaka
Honored Guest
Just started my first project and i'm encountering the same problem. OVRInput.Get does work flawlessly, so the Controller and Button i'm trying to utilize are working correctly.

My OVRInput.GetDown(OVRInput.Button.PrimaryIndexTrigger) (GetUp too) does not return true. When i build the GearVrControllerTest Scene from the SDK and test the controller, i'm not getting a true from the controller on Down either. true at the Button itself and a *False* instead of a False at the Down parameters. 

MohamedElmazen
Protege
if your unity is 2017.2.0f3 

try this

edit OVRInput.cs  inside Update

Change:

        // Promote TrackedRemote to Active if one is connected and no other controller is active
if (activeControllerType == Controller.None)
{
            if ((connectedControllerTypes & Controller.RTrackedRemote) != 0)
            {
                activeControllerType = Controller.RTrackedRemote;
            }
            else if ((connectedControllerTypes & Controller.LTrackedRemote) != 0)
            {
                activeControllerType = Controller.LTrackedRemote;
            }
}

To:

        // Promote TrackedRemote to Active if one is connected and no other controller is active
if (activeControllerType > 0)
{
            if ((connectedControllerTypes & Controller.RTrackedRemote) != 0)
            {
                activeControllerType = Controller.RTrackedRemote;
            }
            else if ((connectedControllerTypes & Controller.LTrackedRemote) != 0)
            {
                activeControllerType = Controller.LTrackedRemote;
            }
}

i change activeControllerType  from Controller.None to activeControllerType  > 0
because we have already an Active Controller but it register to system only when i press trigger Button,
so with my edit we can force system to register the Controller , now I just test OVRInput.GetDown & GetUp its work fine.

hope it help

Jamoke
Explorer
This did not solve the problem for me.  I think this issue is rooted in something else.   One thing I noticed while testing through things in 2017.2 is that when I press the Trigger button on the GearVR Controller, it actually says my active controller is a Gamepad, not an LTrackedRemote.   I was able to get a LOT of anomalous output in 2017.2 that wasn't there in 2017.1.   

Other Mobile VR Frameowkrs have stated that there are some problems on Unity's XR Input side that were introduced in 2017.2 (b11, and f3).  These issues have been confirmed by Unity's staff, and slated for the next patch release of Unity.   Might be worth waiting till 2017.2.0p1 to see if some of this is ironed out Unity's Engine side.

80dots
Honored Guest
I have same issue.
Back key is NOT work.

I wish to fix this problem ASAP...

80dots
Honored Guest
@imperativity

1. Make new Unity project. (I used Unity3D 2017.2)
2. Import OVR Utility (I used 1.19.0 version.)
3. Restart Unity Project.
4. Write the below code. I just show the status of key at UGUI.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class ShowBackKeyStatus : MonoBehaviour {

public Text Status_DownUp;
public Text Status_Pressing;
public Text Status_Touchpad_Pressing;

// Use this for initialization
void Start ()
{
Status_DownUp.text = "Back key Released";
}

// Update is called once per frame
void Update ()
{

//In case of the below code, Back key is NOT work.
bool isPressBackKey = OVRInput.GetDown(OVRInput.Button.Back, OVRInput.Controller.LTrackedRemote) || OVRInput.GetDown(OVRInput.Button.Back, OVRInput.Controller.RTrackedRemote);
bool isReleaseBackKey = OVRInput.GetUp(OVRInput.Button.Back, OVRInput.Controller.LTrackedRemote) || OVRInput.GetDown(OVRInput.Button.Back, OVRInput.Controller.RTrackedRemote);
bool isPressingBackKey = OVRInput.Get(OVRInput.Button.Back, OVRInput.Controller.LTrackedRemote) || OVRInput.GetDown(OVRInput.Button.Back, OVRInput.Controller.RTrackedRemote);

//In case of the below code, Back key works
//bool isPressBackKey = OVRInput.GetDown(OVRInput.Button.Back, OVRInput.Controller.Active);
//bool isReleaseBackKey = OVRInput.GetUp(OVRInput.Button.Back, OVRInput.Controller.Active);
//bool isPressingBackKey = OVRInput.Get(OVRInput.Button.Back, OVRInput.Controller.Active);

//Touchpad is work even if it's same code with Back key.
bool isPressingTouchpad = OVRInput.Get(OVRInput.Button.PrimaryTouchpad, OVRInput.Controller.LTrackedRemote) || OVRInput.Get(OVRInput.Button.PrimaryTouchpad, OVRInput.Controller.RTrackedRemote);

if (isPressBackKey)
{
Status_DownUp.text = "Back key Pressed";
isReleaseBackKey = false;
}
else if(isReleaseBackKey)
{
Status_DownUp.text = "Back key Released";
isPressBackKey = false;
}

Status_Pressing.text = string.Format("Back key Pressing : {0}", isPressingBackKey.ToString());

Status_Touchpad_Pressing.text = string.Format("Touchpad Pressing : {0}", isPressingTouchpad.ToString());
}
}



LivingValkyrie
Honored Guest
im also having this issue, glad to know that theres a ticket open for it. ive tried all builds from 1.16 and up ALL with 4 different unity builds and every combination fails, its really putting a strain on my project. ive developed a really crappy workaround, but its no substitute 

Nilmag
Honored Guest


@80dots

We have an internal task open to fix this issue at this time. Thanks for the additional repro steps.


Can you please reply to this thread when you've created the working build?

Thanks for your efforts in getting this issue resolved. Also if i wanted to HOLD down the trigger key, what code would i need to use for that? I'd test it myself but as you already know it's not working.