EntityManager

class EntityManager(nativeHandle: NativePointer)

Manages entity creation, destruction, and lifecycle.

EntityManager is responsible for allocating and releasing entity IDs, which are opaque 32-bit handles used throughout Filament to refer to scene objects and their components. It is recommended to cache the EntityManager instance.

Thread Safe: All operations on EntityManager are thread-safe.

Constructors

Link copied to clipboard
constructor(nativeHandle: NativePointer)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The number of entities currently alive.

Link copied to clipboard

The current epoch's ID.

Link copied to clipboard

The native object, for interop with code calling the Fila* C API directly. Read-only: this wrapper owns it.

Functions

Link copied to clipboard

Seals the current epoch and starts a new one, recording later destructions there; recycles safe epochs.

Link copied to clipboard
fun create(): Entity

Create a new Entity.

fun create(entities: IntArray)

Creates entities.size entities into entities. Thread safe.

Link copied to clipboard
fun destroy(e: Entity)

Destroy an entity. The entity ID becomes invalid and should not be used after destruction.

fun destroy(entities: IntArray)

Destroys every entity in entities.

Link copied to clipboard

Flushes pending entity lifecycle notifications to registered listeners.

Link copied to clipboard

Check whether an entity is alive (not destroyed).

Link copied to clipboard

Recycles the indices of epochs that are safe to reclaim; advanceEpoch already does this, so it is for tests.