I am trying to figure out how to use the oculus remote in Unity3D 5.3.4f. I've found some documentation about OVR mapping, but I can't seem to figure it out.
What I want to achieve is when the middle button(Button.One) is clicked.
What I now use is this line of code
if (OVRInput.GetUp(OVRInput.Button.One))
{
Debug.Log("remote click");
}
But when I run the application I get this error.
NullReferenceException: Object reference not set to an instance of an object OVRInput.GetUp (Button virtualMask, Controller controllerMask) (at Assets/OVR/Scripts/OVRInput.cs:600) menuButtonHandler.Update () (at Assets/menuButtonHandler.cs:136)
Which can be found in this script
/// <summary>
/// Gets the current up state of the given virtual button mask with the given controller mask.
/// Returns true if any masked button was released this frame on any masked controller and no other masked button is still down this frame.
/// </summary>
public static bool GetUp(Button virtualMask, Controller controllerMask = Controller.Active)
{
return OVRManager.input.GetResolvedButtonUp(virtualMask, RawButton.None, controllerMask);
}
Has anyone used to Oculus remote controller before in unity and can help me out?
Thank you,
Johan
One of the objects in that method likely needs to be initialized before you make the GetUp() call.
Take a close look at your init code, and any samples you may have -- I bet you'll find something missing after not too much looking. I'm not familiar with the Unity APIs, but if they are anything like the PC or mobile C++ APIs, chances are you missed a step, or forgot to start up the VR service.