Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/286.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/unity3d/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在C#中使用鼠标?_C#_Unity3d - Fatal编程技术网

如何在C#中使用鼠标?

如何在C#中使用鼠标?,c#,unity3d,C#,Unity3d,我得到一个错误,说鼠标不存在,虽然我从Unity 4教程中得到了这个,在那里它似乎工作得很好 提前谢谢。为什么不直接传递int而不投射鼠标按钮呢 为什么不直接传递一个int而不用鼠标按钮呢 你错过了课程: using UnityEngine; using System.Collections; public class ExampleClass : MonoBehaviour { void Update() { if (Input.GetMouseButtonDow

我得到一个错误,说鼠标不存在,虽然我从Unity 4教程中得到了这个,在那里它似乎工作得很好


提前谢谢。

为什么不直接传递int而不投射鼠标按钮呢


为什么不直接传递一个int而不用鼠标按钮呢


你错过了课程:

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    void Update() {
        if (Input.GetMouseButtonDown(0))
            Debug.Log("Pressed left click.");

        if (Input.GetMouseButtonDown(1))
            Debug.Log("Pressed right click.");

        if (Input.GetMouseButtonDown(2))
            Debug.Log("Pressed middle click.");

    }
}

你错过了课程:

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    void Update() {
        if (Input.GetMouseButtonDown(0))
            Debug.Log("Pressed left click.");

        if (Input.GetMouseButtonDown(1))
            Debug.Log("Pressed right click.");

        if (Input.GetMouseButtonDown(2))
            Debug.Log("Pressed middle click.");

    }
}
“小老鼠”??不存在“老鼠”吗??不存在。
 public class MouseUtils {
    public enum Button : int { Left = 0, Right = 1, Middle = 2, None = 3 };
}