Anyone who has developed Android should know that every activity in Android has a set of complete lifecycles, and unity scripts have similar lifecycles. Let's take a look at them.
1,Awake ():Script wake-up. This method is the first method executed when the script is generated. It is used to initialize the script. The script is executed only once throughout the lifecycle.
2,Start ():The script starts. This method is executed only once after awake.
3,Update ():Script update. This method is executed after start (), and each frame is executed once. The higher the frame rate, the more frequent the execution.
4,Lateupdate ():Postpone update. This method is executed after Update (). The number of executions is the same as that of update.
5,Fixedupdate ():Fixed update. This method executes a fixed number of times per second. You can select "edit"-> "project"-> "Settings"-> "time ", modify "fixed timestep" in the Inspector view on the right ". The advantage of this function is that the number of executions per second is fixed and suitable for some operations with similar requirements.
6,Ongui ():Draw the interface. This method is also executed once per frame to draw the interface.
7,Ondestroy ():Destroy. Called before the current script is destroyed. Some things to be sorted out before the script is destroyed can be executed in this function.
I personally feel that the life cycle naming of unity is not as easy to understand as that of Android. However, the functions are relatively complete.