UNITY尝试使用Oculus VR集成输入触发CustomEvent(OVRinput)



当我从Oculus触摸控制器获得输入时,我想翻译targetObject。如果我直接这样做,它是有效的,但当我试图触发CustomEvent时,它不起作用。(我没有Oculus Link,所以我正在测试耳机(。我正在努力让博尔特发挥作用,也许这就是问题所在?

using System.Collections.Generic;
using System.Collections;
using UnityEngine;
using OVRTouchSample;
using System;
using Bolt;
public class MyControllerMapping : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{

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

var targetObject = GameObject.Find("ControllerMappingTestObject");
if (OVRInput.GetDown(OVRInput.Button.One))

{

CustomEvent.Trigger(targetObject, "A"); //Doesn't work

}
if (OVRInput.GetDown(OVRInput.Button.One))

{

targetObject.transform.Translate(Vector3.up * Time.deltaTime); //works!

}

}
}

为了正确运行螺栓,需要进行AOT预构建。现在它起作用了。

最新更新