input
底层的设备输入接口,在开发中很少用到
Input.GetKey()
// Update is called once per frame
void Update () {
if (Input.GetKey(KeyCode.A))
{
Debug.Log("get key a");
}
if (Input.GetKeyDown(KeyCode.A))
{
Debug.Log("get key down a");
}
if (Input.GetKeyUp(KeyCode.A))
{
Debug.Log("get key up a");
}
}
Input.GetButton(),Input.GetButtonDown(),GetButtonUp()类似
Input.touches 触屏
Touch[] touches Input.touches;
foreach(Touch t in touches)
{
t.fingerId;
t.deltaPosition;
t.deltaTime;
t.phase;
t.position;
}
TouchScreenKeyboard.Open 触屏输入
TouchScreenKeyboard t = TouchScreenKeyboard.Open("", TouchScreenKeyboardType.Default);