简体   繁体   English

Unity5 OVRInput不起作用

[英]Unity5 OVRInput not working

I'm programming in Unity 5.5 and I have all of the up-to-date Oculus utilities needed, but Unity no longer recognizes any inputs from the touch controllers. 我正在Unity 5.5中编程,并且拥有所需的所有最新Oculus实用程序,但Unity不再能够识别来自触摸控制器的任何输入。 In the past this has worked fine and I can still get the position and rotation of the controllers but now, if I were to do anything like 在过去,这种方法效果很好,我仍然可以获取控制器的位置和旋转角度,但是现在,如果我要做类似的事情,

void Update()
{
    if(OVRInput.Get(OVRInput.RawButton.A)
        Debug.Log("A button pressed");
}

Nothing will happen. 什么都不会发生。 I've tried every sort of OVRInput there is. 我尝试过各种OVRInput。

Is anyone else having the same issue or is there something I am missing?? 还有其他人遇到同样的问题吗?或者我缺少什么?

You should ensure you have an OVRManager component in your scene, it is a singleton. 您应该确保场景中有一个OVRManager组件,它是一个单例。 Attach it to your character gameObject and inputs will work just fine. 将其附加到角色gameObject上,输入即可正常工作。

You have to call this function "OVRInput.Update();" 您必须将此函数称为“ OVRInput.Update();”。 before checking the inputs 在检查输入之前

OVRInput.Update();

if (OVRInput.Get(OVRInput.Button.One)) {
    print("One button pressed");
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM