Skip to content
Author: yuantianle

Unity Life Cycle⚓︎

Here is the official documentation for Unity Life Cycle:

Simplification of Unity Life Cycle

The Unity Life Cycle can be simplified as follows:

alt text

  • Awake: Called when the script instance is being loaded.
  • OnEnable: Called when the object becomes enabled and active.
  • Start: Called on the frame when a script is enabled just before any of the Update methods are called the first time.
  • FixedUpdate: Called every fixed frame-rate frame.
  • Update: Called every frame.
  • LateUpdate: Called every frame after Update has finished.
  • OnGUI: Called multiple times per frame.
  • OnDisable: Called when the behaviour becomes disabled.
  • OnDestroy: Called when the script instance is being destroyed.
FixedUpdate vs Update
  • FixedUpdate: Use FixedUpdate when dealing with physics or other time-dependent operations. It does not depend on the frame rate.

    alt text

  • Update: Use Update when dealing with input or non-physics frame updates. It will be called every frame.

    alt text

Here is the example shows the difference between FixedUpdate and Update:

alt text alt text alt text

Original Video:

Reference⚓︎

Comments