Forum Discussion
GarrettSkye
8 years agoMHCP Member
OVRInput.GetUp not working correctly in Unity 2017.2 with GearVR Controller
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...
80dots
8 years agoHonored 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.
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());
}
}
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device