EntityTemplate

Entity template structure.

Entity contain whole information needed to create new entity. Allocating EntityTemplate is considered as more expensive operation than adding entity. Whole components memory is stored in EntityTemplate and is copyied to newly added entity. If you want to place several entity with small difference in data then you should take pointer to component and change it before every entity addition.

There is no restriction about number of allocated templates. Single template can be used from multiple threads, but if you want to changes some components data before add entity (entity position for example) it's better to use multiple templates.

Members

Functions

getComponent
T* getComponent()

Get specified component. If component doesn't exist function return null. Returned pointer is valid during EntityTemplate lifetime.

getComponent
void* getComponent(ushort component_id)

Get specified component. If component doesn't exist function return null. Returned pointer is valid during EntityTemplate lifetime.

Variables

entity_data
ubyte[] entity_data;

Entity components data

info
EntityManager.EntityInfo* info;

Pointer to entity type info.

Meta