menu_bookDocumentation

s&box Component Lifecycle: Exact Execution Order and Internal Guards

calendar_today May 4, 2026 schedule ~2 min read person patrickjr verified 50

s&box Component Lifecycle: Exact Execution Order and Internal Guards

Derived directly from Component.cs and Component.Update.cs in the s&box engine source.

Execution Order

  1. OnAwake() — Called once when the Component is first initialized. Runs inside GameTransform.DisableInterpolation() scope, so Transform changes here won't be interpolated.
  2. OnEnabled() — Called after OnAwake or whenever the component transitions from disabled → enabled. Also runs inside DisableInterpolation().
  3. OnStart() — Called once before the first OnUpdate(). Deferred until the first update tick after the component becomes active. Also runs inside DisableInterpolation().
  4. OnUpdate() — Called every frame while enabled.
  5. OnFixedUpdate() — Called at a fixed interval (physics tick rate). Time.Delta is the fixed interval here.
  6. OnPreRender() — Called before rendering. Not called on dedicated servers (Application.IsHeadless).
  7. OnDisabled() — Called when the component transitions from enabled → disabled.
  8. OnDestroy() — Called once when the component is destroyed.

Key Internal Guards

Callback Batching

Lifecycle callbacks (OnAwake, OnEnabled, OnDisabled, OnDestroy, OnValidate) are queued via CallbackBatch rather than called immediately. This prevents re-entrant issues during scene loading or destruction.

Action-Based Callbacks

Components expose action properties for use in ActionGraph / no-code contexts: Setting OnComponentUpdate or OnComponentFixedUpdate to a non-null value registers the component in the scene's update set even if it doesn't implement IUpdateSubscriber.
Was this helpful?