onEntityRemoved

inline fun Engine.onEntityRemoved(family: Family = anyFamily, priority: Int = 0, crossinline onRemoved: (entity: Entity) -> Unit): EntityRemovalListener

Adds an EntityRemovalListener to this Engine and returns a reference to the new listener instance. The listener calls onRemoved 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.onEntityRemoved(priority: Int = 0, crossinline onRemoved: (entity: Entity) -> Unit): EntityRemovalListener

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


inline fun IntervalIteratingSystem.onEntityRemoved(priority: Int = 0, crossinline onRemoved: (entity: Entity) -> Unit): EntityRemovalListener

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


inline fun SortedIteratingSystem.onEntityRemoved(priority: Int = 0, crossinline onRemoved: (entity: Entity) -> Unit): EntityRemovalListener

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