来自于:万士辰
void Update()
{
//识别键盘输入
//键盘A键按住
//第一种方式 "a" 必须是小写字母
if (Input.GetKey("a"))
{
}
//第二种方式 KeyCode的枚举类型
if (Input.GetKey(KeyCode.A))
{
}
//键盘A按下瞬间
if (Input.GetKeyDown("a"))
{
}
if (Input.GetKeyDown(KeyCode.A))
{
}
//键盘A抬起瞬间
if (Input.GetKeyUp("a"))
{
}
if (Input.GetKeyUp(KeyCode.A))
{
}
//识别鼠标输入
//鼠标左键按住
//int 0 (右键1 中键2)
if (Input.GetMouseButton(0))
{
}
//鼠标左键按下瞬间
if (Input.GetMouseButtonDown(0))
{
}
//鼠标左键抬起瞬间
if (Input.GetMouseButtonUp(0))
{
}
}