【问题标题】:Samsung Gear VR - open menu item from Gear VR tap click三星 Gear VR - 从 Gear VR 打开菜单项 点击点击
【发布时间】:2015-08-25 08:00:46
【问题描述】:

我使用渲染模式工作空间创建菜单(画布 ui),它由两个按钮组成

开始

退出

我尝试使用 Gear Taps 打开启动,但它不起作用

sing UnityEngine;
using System.Collections;

public class LoadOnClick : MonoBehaviour {

    public void LoadScene(int Level){
        if (Input.GetButtonDown (0)) {
            Application.LoadLevel (Level);
        }

    }
}

请注意,当我进入播放模式时,它对我有用,通过鼠标点击

建议我应该为按钮添加标签

我想要确保我理解清楚,当 On CLick 触发时运行我的脚本

我可以在这里指定输入吗

【问题讨论】:

    标签: c# unity3d oculus virtual-reality gear-vr


    【解决方案1】:

    我自己还没有尝试过,但根据 the unity docs 你应该替换:

    Input.GetButtonDown(0)
    

    与

    Input.GetMouseButtonDown(0)
    

    -编辑- 还有一个建议here使用:

    Input.GetButtonDown("Mouse 0")
    

    -进一步编辑- 我做了一个快速测试,Input.GetMouseButtonDown (0) 是三个注册点击的唯一变体,所以我会使用它。

    此示例项目显示并在点击垫时重置计时器:

    public Text timerText;
    public float timeLeft;
    
    void Start ()
    {
        timeLeft = 5;
    }
    
    void Update()
    {
        timeLeft -= Time.deltaTime;
        timerText.text = timeLeft.ToString ();
    
        if(timeLeft < 0)
        {
            GameOver();
        }
    }
    
    void GameOver()
    {
        timerText.text = "-- --";
        // restart on tap
        if (Input.GetMouseButtonDown (0)) 
        {
            Start ();
        }
    } 
    

    【讨论】:

    • 谢谢你的回答,但我更新了我的问题,我需要知道什么时候点击触发?哪个输入需要
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-07-02
    • 1970-01-01
    相关资源
    最近更新 更多