menu_bookDocumentation

GameObjectSystem - s&box Scene Documentation

calendar_today May 5, 2026 schedule ~1 min read person patrickjr verified 50

GameObjectSystem

GameObjectSystems are global systems that operate on groups of GameObjects. Unlike Components which are attached to single GameObjects, systems can process many objects and run at specific stages of the frame.

Implementation

Create a system by inheriting from GameObjectSystem:

CSHARP
[Group( "MyGame" )] // For organization in editor
public class MyGameSystem : GameObjectSystem
{
    public MyGameSystem( Scene scene ) : base( scene )
    {
        // Initialize the system
        ListenToStage( Stage.Update, PreUpdate );
        ListenToStage( Stage.FinishUpdate, PostUpdate );
    }
    
    void PreUpdate()
    {
        // Runs early in the update loop
    }
    
    void PostUpdate()
    {
        // Runs at the end of the update loop
    }
}

Access

Access your system from components:

CSHARP
var mySystem = Scene.GetSystem<MyGameSystem>();
mySystem?.DoSomething();

Stages and Order

Systems listen to specific stages with ListenToStage:

StageWhen It Runs
Stage.StartupScene initialization
Stage.UpdateMain update loop
Stage.FinishUpdateEnd of frame
Stage.PhysicsStepPhysics simulation
Stage.RenderRendering

Configuration

Systems can have configurable properties:

CSHARP
[ConVar( "mygame_max_enemies" )]
public static int MaxEnemies { get; set; } = 50;

Systems are powerful for global game logic like:

  • Spawn managers

  • Wave systems

  • Global game state

  • Performance monitoring

  • Analytics tracking

Was this helpful?