System
Create/Remove Entity
Create
Create
creates a single entity with a given set of components.
Example
Parameters
Parameter | Type | Description |
---|---|---|
worldCtx | WorldContext | A WorldContext object passed in to your system. |
components | …metadata.Component | Variadic parameter for components to associate with the created entity. |
Return Values
Type | Description |
---|---|
EntityID | The ID of the created entity. |
error | An error indicating any issues that occurred during the creation process. |
CreateMany
CreateMany
creates a specified amount of entities with a specified set of components.
Example
Parameters
Parameter | Type | Description |
---|---|---|
worldCtx | WorldContext | A WorldContext object passed in to your system. |
num | int | The number of entities to create. |
components | …metadata.Component | Variadic parameter for components to associate with the created entities. |
Return Values
Type | Description |
---|---|
[]EntityID | A slice of EntityID representing the IDs of the created entities. |
error | An error indicating any issues that occurred during the creation process. |
Remove
Remove
removes a given entity from the World
.
Example
Parameters
Parameter | Type | Description |
---|---|---|
worldCtx | WorldContext | A WorldContext object passed in to your system. |
id | entity.ID | The entity ID to be removed from the world. |
Return Value
Type | Description |
---|---|
error | An error indicating any issues that occurred during the removal process. |