Skip to content

Game.SystemUpdatePhase

Assembly: Assembly-CSharp (typical for game/mod assemblies)
Namespace: Game

Type: enum

Base: System.Enum

Summary: Represents the named phases of the game's system update loop. This enum is used by the engine/mod systems to categorize and order logic runs (modification steps, simulation, rendering, UI, tools, serialization, etc.). Values provide a stable, human-readable way to reference when a particular system or operation should run during a frame or during simulation/load sequences. Use these phases to schedule or gate system execution and to reason about update ordering.


Fields

  • Invalid = -1
    Represents an invalid or uninitialized phase.

  • MainLoop = 0
    The core main-loop phase; primary entry for per-frame logic.

  • LateUpdate
    LateUpdate stage after the main loop; typically for follow-up work.

  • Modification1
    First modification phase used for staged changes before simulation.

  • Modification2
    Second modification stage.

  • Modification2B
    An additional split of Modification2 for finer ordering.

  • Modification3
    Third modification phase.

  • Modification4
    Fourth modification phase.

  • Modification4B
    An additional split of Modification4.

  • Modification5
    Fifth modification phase; typically the last modification in the chain.

  • ModificationEnd
    Marks the end of modification phases.

  • PreSimulation
    Work performed immediately before the simulation step starts.

  • PostSimulation
    Work performed immediately after the simulation step ends.

  • GameSimulation
    Simulation phase used in normal gameplay.

  • EditorSimulation
    Simulation phase used when the editor is running the simulation (different ordering or behavior may apply).

  • Rendering
    General rendering phase where rendering-related systems run.

  • PreTool
    Work performed before a tool update runs.

  • PostTool
    Work performed immediately after a tool update.

  • ToolUpdate
    Tool logic update phase (e.g., in-editor tools).

  • ClearTool
    Phase to clear or reset tool-related state.

  • ApplyTool
    Phase to apply tool changes to game state.

  • Serialize
    Phase where state is serialized (saving, preparing data).

  • Deserialize
    Phase where state is deserialized (loading).

  • UIUpdate
    Main UI update phase.

  • UITooltip
    UI tooltip update phase (rendering/updating tooltips).

  • PrefabUpdate
    Update phase for prefabs and their runtime instances.

  • DebugGizmos
    Phase for drawing or updating debug gizmos.

  • LoadSimulation
    Phase used when loading a simulation (distinct from normal simulation).

  • PreCulling
    Work done before the culling stage of rendering.

  • CompleteRendering
    Marks the completion of the rendering sequence.

  • Raycast
    Phase dedicated to performing raycasts (e.g., for picking, physics queries).

  • PrefabReferences
    Phase to update or resolve prefab references.

  • Cleanup
    Final cleanup phase at the end of a frame or process.

Properties

  • (none)
    This enum type exposes no properties. Use enum comparisons, Enum methods, or switch statements to work with values.

Constructors

  • (implicit) SystemUpdatePhase()
    Enums have an implicit default constructor; members are treated as constant values. There are no user-defined constructors.

Methods

  • (none)
    As a plain enum, there are no instance methods. Use System.Enum static helpers when needed (Enum.IsDefined, Enum.GetValues, Enum.Parse, etc.).

Usage Example

// Example: Using SystemUpdatePhase in a switch to control per-phase logic
public void ExecutePhase(SystemUpdatePhase phase)
{
    switch (phase)
    {
        case SystemUpdatePhase.MainLoop:
            // Core per-frame logic
            break;
        case SystemUpdatePhase.PreSimulation:
            // Prepare simulation inputs
            break;
        case SystemUpdatePhase.GameSimulation:
            // Run simulation step
            break;
        case SystemUpdatePhase.PostSimulation:
            // Apply simulation results
            break;
        case SystemUpdatePhase.Rendering:
            // Rendering-related updates
            break;
        default:
            // Handle other phases or ignore
            break;
    }
}

// Example: Validate and iterate enum values
foreach (SystemUpdatePhase p in Enum.GetValues(typeof(SystemUpdatePhase)))
{
    if (p == SystemUpdatePhase.Invalid) continue;
    // Register or log phase ordering
    Debug.Log($"Phase: {p}");
}