void Update()
{
//监听键盘输入
if (Input.GetKeyDown(KeyCode.A))//KeyCode.A键盘A
{
Debug.Log("A键按下");
}
if (Input.GetKey(KeyCode.A))
{
Debug.Log("A键按下中");
}
if (Input.GetKeyUp(KeyCode.A))
{
Debug.Log("A键抬起");
}
//监听鼠标输入
if (Input.GetMouseButtonDown(0))
{
Debug.Log("鼠标左键按下入");
}
if (Input.GetMouseButton(0))
{
Debug.Log("鼠标左键按下入");
}
if (Input.GetMouseButtonUp(0))
{
Debug.Log("鼠标左键抬起");
}
//鼠标对应关系:0鼠标左键,1代表鼠标右键,2代表鼠标滚轮
if (Input.GetMouseButtonDown(0)){
Debug.Log("鼠标左键按下");
}
if (Input.GetMouseButtonDown(1))
{
Debug.Log("鼠标右键按下");
}
if (Input.GetMouseButtonDown(2))
{
Debug.Log("鼠标滚轮键按下");
}
}