What is Unity Life Cycle?
Unity Life Cycle
The Predetermined Order to execute a number of event functions from top to bottom in Unity Script is called Unity Life Cycle.
Reset
This function is called to initialize the script's properties when it attached to the object and also when the Reset command is used.
Awake()
This function is always called before every Start Function.
Some Possibilities;-
1) If the script attached to the GameObject, and the GameObject is inactive in the scene Awake is not called until it is being active.
2)No matter the script is active or not on the GameObject If the GameObject is Active Awake will call.
OnEnable()
This function is always called just when the GameObject is Enabled.
OnStart()
This Function called just before the first fame update.
It only called when the script is enabled.
FixedUpdate()
This Function can be called multiple times, or zero times per frame. This is used for Physics Calculations in Unity.
YieldWaitForFixedUpdate()
This Function will always be called after all FixedUpdate has been called on all Scripts in Unity.
Update()
This Function is the most common function, it called only once per frame.
Yield null and YieldWaitForSeconds
This Function called after all Update have been called, and continue after a specified time delay.
LateUpdate()
This function is called once per frame after Update has finished. It is used to perform for any calculations.
OnWillRenderObject
Always Called once for each camera when the object is visible in Unity.
OnGUI
This function called multiple times per frame to respond to the Graphics events and input events given by keyboard or mouse.
YieldWaitForEndFrame
This function is called when the editor switched Game view to Scene view. It waits for the end of the frame after unity has rendered every camera.
It only works in Unity Editor.
OnDisable()
This function is called when the GameObject is inactive or disable in-game.
OnDestroy()
This function will be called to stopping the play mode in the editor will end the application.