Skip to content

Interface IComponentListener<T> ​

Namespace: KenseiECS

Typed observer for one component pool. Register via pool.AddListener(). OnAdded runs after the component is stored and filters are updated; OnRemoved runs before AutoReset, so the component data is still intact. A listener hears the changes that happen after it subscribed: one that a filter or world listener subscribes while a component is being added gets no OnAdded for that component.

csharp
public interface IComponentListener<T> where T : struct, IComponent

Type Parameters ​

T

Methods ​

OnAdded(int, ref T) ​

Called after the component is added; component refers to the stored value.

csharp
void OnAdded(int entityIndex, ref T component)

Parameters ​

entityIndex int

component T

OnRemoved(int, ref T) ​

Called before the component is removed and reset; component refers to the stored value.

csharp
void OnRemoved(int entityIndex, ref T component)

Parameters ​

entityIndex int

component T