【发布时间】:2017-09-26 12:03:52
【问题描述】:
我正在尝试弄清楚如何在 Unity3D 5.3.4f 中使用 oculus 遥控器。我找到了一些关于 OVR 映射的 documentation,但我似乎无法弄清楚。
我想要实现的是单击中间按钮(Button.One)时。
我现在用的是这行代码
if (OVRInput.GetUp(OVRInput.Button.One))
{
Debug.Log("remote click");
}
但是当我运行应用程序时,我得到了这个错误。
NullReferenceException:对象引用未设置为对象的实例 OVRInput.GetUp(按钮 virtualMask,控制器 controllerMask)(在 Assets/OVR/Scripts/OVRInput.cs:600) menuButtonHandler.Update() (在 Assets/menuButtonHandler.cs:136)
可以在这个脚本中找到
/// <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);
}
有没有人在unity之前使用过Oculus遥控器并且可以帮助我?
谢谢,
约翰
【问题讨论】: