- void FixedUpdate(){
- AddGravity();
if(Input.GetKey(KeyCode.Space)){
move.y=Mathf.SmoothDamp(0,1,ref speed,0.1f);
Debug.Log("1");
Debug.Log(move.y);
}
if(Input.GetKeyDown(KeyCode.Space)){
Debug.Log("2");
}
x=move.y;
cha.Move(move);
}
结果可看出
Input.GetKey()按下一直为true
Input.GetKeyDown()按下一瞬间为true