Use of virtual axes

//Get the horizontal and vertical axes

float horizontal = Input.GetAxis("Horizontal");

float vertical = Input.GetAxis("Vertical");

The return value is as you press A, the horizontal axis approaches -1, you will get a value, you can use this value to time keyboard input, and it is convenient to transplant and expand the operation mode of the game in the future.

//Similarly there are virtual keys

おすすめ

転載: blog.csdn.net/zkx0214/article/details/127125501