c# - 如何使用触摸板 gearVR

标签 c# android unity3d oculus gear-vr

我尝试编写一个脚本来在有人触摸(三星 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/

相关文章:

c# - 使用接口(interface)松耦合 NoSQL 提供程序

c# - 动态创建的路由仅在应用程序重新初始化时才有效

Android PubNub 未通过 FCM 接收推送通知

c# - 统一注册表单验证

c# - Raycast 如何与 Unity 的 Canvas UI 元素交互?

c# - 为什么按增量时间计算?

c# - 节流 IObservable 导致观察者未被调用

c# - OOPS 概念 : What is the difference in passing object reference to interface and creating class object in C#?

java - E/RecyclerView : No adapter attached; skipping layout. AsyncTask 中的问题

java - 轻量级物理引擎Android