Menu
CoddyTech

Recap: Lifecycle Logger

Part of the Unity Scripting Basics section of Coddy's Unity journey. Lesson 59 of 67.

challenge icon

Challenge

Medium

Write a script that shows Unity's order in the Console. Each of these methods logs its own name, exactly as written here: Awake, OnEnable, Start, FixedUpdate, Update, LateUpdate, OnDisable, OnDestroy.

  • FixedUpdate, Update and LateUpdate run again and again, so each of them logs only on its first call.
  • Space destroys the object, so that the last two get their turn.

Press Play, press Space, read the Console, then Check.

Try it yourself

using UnityEngine;

public class LifecycleLogger : MonoBehaviour
{
    // Log each method's name: Awake, OnEnable, Start, FixedUpdate, Update,
    // LateUpdate, OnDisable, OnDestroy. The three that repeat log only once.
    // Space destroys this object.
}

All lessons in Unity Scripting Basics