Unity基础-Input接口
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()类似
SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。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);

更多精彩