Skip to content

IEntityWorld.AddSystem Method

Definition

Namespace: Brine2D.ECS

Overloads
AddSystem<T>\(Action<T>\) Adds a system to this world, automatically creating it with dependency injection. Systems that implement IUpdateSystem are added to the update pipeline. Systems that implement IFixedUpdateSystem are added to the fixed update pipeline. Systems that implement IRenderSystem are added to the render pipeline. Systems can implement multiple interfaces.
AddSystem<T>\(T\) Adds a pre-constructed system instance to this world, bypassing dependency injection. Use this when the system requires constructor arguments that are not registered in DI, or when the system was obtained from an object pool or factory.

IEntityWorld.AddSystem\<T>\(Action\<T\>\) Method

Adds a system to this world, automatically creating it with dependency injection. Systems that implement IUpdateSystem are added to the update pipeline. Systems that implement IFixedUpdateSystem are added to the fixed update pipeline. Systems that implement IRenderSystem are added to the render pipeline. Systems can implement multiple interfaces.

C#
void AddSystem<T>(System.Action<T>? configure=null)
    where T : class, Brine2D.ECS.ISystem;

Type parameters

T

The system type to create and add.

Parameters

configure System.Action<T>

Optional configuration action for the system.

IEntityWorld.AddSystem\<T>\(T\) Method

Adds a pre-constructed system instance to this world, bypassing dependency injection. Use this when the system requires constructor arguments that are not registered in DI, or when the system was obtained from an object pool or factory.

C#
void AddSystem<T>(T instance)
    where T : class, Brine2D.ECS.ISystem;

Type parameters

T

The system type. Must implement at least one pipeline interface.

Parameters

instance T

The pre-constructed system instance to register.

Exceptions

System.ArgumentNullException
Thrown when instance is null.

System.InvalidOperationException
Thrown when a system of type T is already registered, or when instance does not implement any pipeline interface.