GameObjectSystem: Batch Processing and Execution Order Control
A GameObjectSystem lets you run logic at specific points during the frame for all components of a type, rather than relying on individual component Update methods. This is faster for batch processing and avoids execution order issues.
Creating a System
public class MyGameSystem : GameObjectSystem
{
public MyGameSystem( Scene scene ) : base( scene )
{
Listen( Stage.PhysicsStep, 10, DoSomething, "DoingSomething" );
}
void DoSomething()
{
var allThings = Scene.GetAllComponents<MyThing>();
// Process all things in one batch
}
}When a scene is created, every defined GameObjectSystem is automatically instantiated and added.
Accessing a System
Access via Scene.Get<T>():
var system = Scene.Get<MyGameSystem>();Or inherit from GameObjectSystem<T> for a static Current property:
public class MyGameSystem : GameObjectSystem<MyGameSystem>
{
public MyGameSystem( Scene scene ) : base( scene ) { }
public void MyMethod()
{
Log.Info( "Hello, World!" );
}
}
// Usage anywhere:
MyGameSystem.Current.MyMethod();Stages and Order
The Listen method takes a Stage (when to run), an order value (negative = before, positive = after), and the method to call.
Stages are based around certain events — for example Stage.PhysicsStep runs during FixedUpdate.
Configuration
Properties marked with [Property] on a GameObjectSystem are configurable in Project Settings under the Systems section and are saved per-project.
When to Use
- Processing all components of a type in batch (faster than individual Update calls)
- Controlling execution order precisely
- Running logic that depends on other systems completing first (e.g., reading bone positions after animation)