Skip to main content

Class: EntityManager

Creates and manages entities.

Constructors​

Constructor​

new EntityManager(): EntityManager;

Returns​

EntityManager

Methods​

Create()​

static Create(name): Promise<number>;

Creates a new entity.

Parameters​

ParameterTypeDescription
namestringHuman-readable name to assign to the new entity.

Returns​

Promise<number>

A promise that resolves to the newly created Entity handle.


Destroy()​

static Destroy(entity): Promise<boolean>;

Destroys an existing entity.

Parameters​

ParameterTypeDescription
entitynumberThe Entity handle to remove from the runtime.

Returns​

Promise<boolean>

A promise that resolves to true when the entity was destroyed successfully, or false when the destroy operation was rejected or failed.


SetActive()​

static SetActive(entity, active): Promise<void>;

Sets whether an entity is active.

Parameters​

ParameterTypeDescription
entitynumberThe Entity handle to update.
activebooleantrue to activate the entity; false to deactivate it.

Returns​

Promise<void>

A promise that resolves when the active state has been changed.


GetActive()​

static GetActive(entity): Promise<boolean>;

Retrieves whether an entity is currently active.

Parameters​

ParameterTypeDescription
entitynumberThe Entity handle to inspect.

Returns​

Promise<boolean>

A promise that resolves to true if the entity is active, otherwise false.


SetName()​

static SetName(entity, name): Promise<void>;

Set the name of an entity.

Parameters​

ParameterTypeDescription
entitynumberThe Entity to rename.
namestringThe new human-readable name for the entity.

Returns​

Promise<void>

A promise that resolves when the name has been changed.


GetName()​

static GetName(entity): Promise<string>;

Gets the name of an entity.

Parameters​

ParameterTypeDescription
entitynumberThe Entity whose name should be returned.

Returns​

Promise<string>

A promise that resolves to the entity's current name.