测试代码
// Update is called once
private void OnGUI()
{
if(Input.anyKey && Event.current.isKey && Event.current.keyCode != KeyCode.None)
{
// Debug.Log(Event.current.keyCode);
if(KeyboardEvent!=null)
{
KeyboardEvent.Invoke(Event.current.keyCode);
}
}
if(Input.anyKey && Event.current.keyCode!=KeyCode.None)
{
Debug.Log("Input.anyKey " + Event.current.keyCode);
}
if(Input.GetKey(KeyCode.W))
{
Debug.Log("Input.GetKey W");
}
if (Input.GetKey(KeyCode.D))
{
Debug.Log("Input.GetKey D");
}
if (Input.GetKey(KeyCode.A))
{
Debug.Log("Input.GetKey A");
}
if (Input.GetKey(KeyCode.S))
{
Debug.Log("Input.GetKey S");
}
}