The use of unity scene classes, transform components, and mouse and keyboard monitoring events

      Scenes can be superimposed

       

       LoadScenceMode.Single is the replacement scene

       LoadScenceMode.Additive is to increase the scene

 

        Asynchronously loading and adding progress bar time

 

d76eb86efa354bcbafbe5e35dde46398.jpg

 

 

       //About the use of transform: you can keep the object facing one point

       transform.LookAt(Vector3.zero);

       //move

       transform.Translate(Vector3.forword * 0.1f);//The speed can be modified

 

 

      Keyboard and mouse operation related scripts

//Click of the mouse//Press the mouse 0 left button 1 right button 2 scroll wheel

Input.GetMouseButtonDown(0) returns a Boolean value

//Continue to press the mouse

Input.GetMouseButton(0)

//lift the mouse

Input.GetMouseButtonUp(0)

//Press the keyboard key

Input.GetKeyDown(KeyCode.A)

//Continue to press the keyboard key

Input.GetKey(KeyCode.A)

//lift the keyboard key

Input.GetKeyUp(KeyCode.A)

 

The above reading commands for the key and mouse are placed in the update; function to achieve the monitoring effect of the key and mouse during the game

Guess you like

Origin blog.csdn.net/zkx0214/article/details/127121749