onEntityAdded

inline fun Engine.onEntityAdded(family: Family = anyFamily, priority: Int = 0, crossinline onAdded: (entity: Entity) -> Unit): EntityAdditionListener

Adds an EntityAdditionListener to this Engine and returns a reference to the new listener instance. The listener calls onAdded lambda every time an entity addition event is triggered.

The family parameter allows targeting a specific subset of entities. By default, anyFamily is used, matching every entity within the engine.

The priority argument affects the order in which the listeners are triggered. Lower value means higher priority.

To remove this EntityListener from the Engine afterwards, retain the reference returned by this method and pass it to Engine.removeEntityListener.


inline fun IteratingSystem.onEntityAdded(priority: Int = 0, crossinline onAdded: (entity: Entity) -> Unit): EntityAdditionListener

A wrapper for Engine.onEntityAdded that uses this IteratingSystem's Family as a filter for the EntityAdditionListener.


inline fun IntervalIteratingSystem.onEntityAdded(priority: Int = 0, crossinline onAdded: (entity: Entity) -> Unit): EntityAdditionListener

A wrapper for Engine.onEntityAdded that uses this IntervalIteratingSystem's Family as a filter for the EntityAdditionListener.


inline fun SortedIteratingSystem.onEntityAdded(priority: Int = 0, crossinline onAdded: (entity: Entity) -> Unit): EntityAdditionListener

A wrapper for Engine.onEntityAdded that uses this SortedIteratingSystem's Family as a filter for the EntityAdditionListener.