Manager for creating and destroying entities.
The EntityManager keeps track of all live entities in the game and can be used to create and destroy entities.
The EntityManager is a singleton (there is only one EntityManager), so you don't need to pass it into the functions. All the functions operate on the EntityManager singleton.
Related sample code
Appkit: /simple_project.lua Oculus VR template: /project_utils.lua Steam VR template: /project_utils.lua |
Other related reference items
Related help topics
actor_component ( world ) : stingray.ActorComponentReturns the ActorComponent of the world.
|
world : | The world whose actor component we should return. |
The actor component of the world. |
The actor component can be used to add physical actors to entities.
alive ( entity ) : booleanChecks if an entity is still alive.
|
entity : | The entity to check. |
boolean |
Returns true if the entity is alive. |
Other related reference items
animation_blender_component ( world ) : stingray.AnimationBlenderComponentReturns the AnimationBlenderComponent of the world.
|
world : | The world whose component we should return. |
The animation blender component of the world. |
The animation blender component handles animation blending for entities.
animation_state_machine_component ( world ) : stingray.AnimationStateMachineComponentReturns the AnimationStateMachineComponent of the world.
|
world : | The world whose component we should return. |
The animation state machine component of the world. |
The animation state machine component handles animation state machines for entities.
create ( world ) : stingray.EntityCreates a new blank entity without any components.
|
world : | The world that should own the entity. The ? notation indicates that this type is optional: there may be zero or one instances of it. |
The newly created entity. |
If a World is specified, the entity will be owned by that world. The entity will be automatically destroyed when the world is destroyed.
If no world is specified, the entity will live until it is explicitly destroyed by a call to destroy.
data_component ( ) : stingray.DataComponentReturns the global DataComponent.
|
This function does not accept any parameters. |
The global data component. |
The data component can store blobs of dynamic data for entities.
debug_name ( entity ) : stringReturns the name of the entity for debugging purposes.
|
entity : | The entity whose name we should check. |
string |
The debug name of the entity or "" if no name has been set. |
Use set_debug_name to set the name.
Other related reference items
debug_name_component ( ) : stingray.DebugNameComponentReturns the global DebugNameComponent.
|
This function does not accept any parameters. |
The global debug name component. |
The debug name component stores a debug name for each entity.
destroy ( entity )Destroys the specified entity.
|
entity : | The entity to destroy. |
This function does not return any values. |
Destroying an entity also destroys all components owned by the entity.
Other related reference items
flow_component ( world ) : stingray.FlowComponentReturns the FlowComponent of the world.
|
world : | The world whose flow component we should return. |
The flow component of the world. |
The flow component can be used to assign, trigger, and manipulate flow on entities.
mesh_component ( world ) : stingray.MeshComponentReturns the MeshComponent of the world.
|
world : | The world whose mesh component we should return. |
The mesh component of the world. |
The mesh component can be used to add graphics meshes to entities.
render_data_component ( world ) : stingray.RenderDataComponentReturns the RenderDataComponent of the world.
|
world : | The world whose component we should return. |
The tag component of the world. |
The render data component can store blobs of dynamic data for rendering entities.
scene_graph_component ( world ) : stingray.SceneGraphComponentReturns the SceneGraphComponent of the world.
|
world : | The world whose actor component we should return. |
The scene graph component of the world. |
The scene graph component handles scene graphs for entities.
script_component ( world ) : stingray.ScriptComponentReturns the ScriptComponent of the world.
|
world : | The world whose component we should return. |
The script component of the world. |
The script component links entities to scripts.
set_debug_name ( entity, name )Sets a name for the entity for debugging purposes.
|
entity : | The entity whose name should be changed. | |
name : | string | The name to set for the entity. |
This function does not return any values. |
The entity name cannot be longer than 31 characters. Use debug_name to get the name.
Other related reference items
spawn ( world, entity_resource, position, orientation ) : stingray.EntitySpawns an entity from a .entity resource file and returns it.
|
world : | The world in which the entity should be spawned. | |
entity_resource : | string | The name of the entity's resource, e.g. "entities/trees/pine". |
position : | The position where the entity should be spawned. | |
orientation : | The orientation of the spawned entity. If not specified, the identity orientation is used. The ? notation indicates that this type is optional: there may be zero or one instances of it. |
The newly spawned entity. |
spawn ( world, entity_resource, pose ) : stingray.EntitySpawns an entity from a .entity resource file and returns it.
|
world : | The world in which the entity should be spawned. | |
entity_resource : | string | The name of the entity's resource, e.g. "entities/trees/pine". |
pose : | The pose of the spawned entity. |
The newly spawned entity. |
tag_component ( world ) : stingray.TagComponentReturns the TagComponent of the world.
|
world : | The world whose component we should return. |
The tag component of the world. |
The tag component handles tags for entities.
transform_component ( world ) : stingray.TransformComponentReturns the TransformComponent of the world.
|
world : | The world whose transform component we should return. |
The transform component of the world. |
The transform component can be used to add transforms to entities.
unit_component ( world ) : stingray.UnitComponentReturns the UnitComponent of the world.
|
world : | The world whose component we should return. |
The unit component of the world. |
The unit component links units to entities.