我尝试编写一个脚本来在有人触摸(三星 Gear VR 的)触摸板时更改天空盒。我对触摸板输入做了一些研究,发现它应该像鼠标一样工作。 太棒了,我已经做到了:
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class skyboxSwitcher : MonoBehaviour {
public List<Material> boxes = new List<Material>();
private int index = 0;
void Update() {
if (Input.GetMouseButtonDown(0))
switchBox();
}
public void switchBox() {
if (boxes.Count > 0) {
index++;
if (index >= boxes.Count) {
index = 0;
}
RenderSettings.skybox = boxes[index];
}
}
}
但这是行不通的。我阅读了文档并尝试了一些其他输入,但仍然得到相同的结果。也许有人已经有同样的问题?谢谢:)
最佳答案
这应该可行,但您也可以使用:
if (Input.GetButtonDown("Fire1"))
但您最终需要 Unity 5.2(我认为)。
关于c# - 如何使用触摸板 gearVR,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33933578/