docs
Systems
Infrastructure
UpdateSystem
UpdateSystem Overview

The UpdateSystem lets plain C# objects receive a once-per-frame tick without inheriting from MonoBehaviour. Objects implement IUpdateable, and the system drives them from Unity's PlayerLoop Update phase.

Purpose in SaffronLibrary

The system sits in the _Core/Infrastructure layer. It keeps the per-frame logic in pure C# (UpdateManager) and confines the Unity-specific timing to a small adapter (UnityUpdateAdapter). Other systems reach it through the command bus rather than by holding a reference to the manager.

Key responsibilities

  • Maintain an ordered registry of IUpdateable objects and call OnUpdate on each one every tick (UpdateManager).
  • Connect the engine heartbeat to the manager through IUpdateAdapter. UnityUpdateAdapter injects the tick into the PlayerLoop Update phase using UpdateService and UpdateUtility.
  • Accept registration requests sent as Register commands on the Update domain. UpdateCommandFactory.RegisterUpdatable builds and sends these, and UpdateFlowController routes them to the manager.

Who should use it

  • Gameplay or service developers who need a per-frame callback on a non-MonoBehaviour class.
  • Infrastructure maintainers who work on the engine bridge or PlayerLoop integration.

Connections to other systems

The system depends on the Contracts system for the Domain enum (it uses Domain.Update), on the Params system for typed command payloads, on the Commands system for building commands, and on the Bus system for sending them. It also extends the Flow system's FlowController base class so it can receive commands for its domain.