This repository was archived by the owner on Oct 22, 2023. It is now read-only.
- Notifications
You must be signed in to change notification settings - Fork 182
Workflow: Spawning an entity
proepkes edited this page Feb 19, 2019 · 3 revisions
In the Unity project there is an entity-database which contains all spawnable prefabs that exist in the simulation. The following steps are made when a spawn-command is issued by an actor:
- the spawn command sets which entity should be spawned by calling AddDatabaseEntityID on the inputEntity
`
public class SpawnCommand : ICommand { public void Execute(InputEntity e) { e.AddCoordinate(Position); e.AddDatabaseEntityId(DatabaseEntityId); } - the framework receives the command and creates a new game-entitiy 3.1) some necessary components are added to the game-entity (e.g. ID-fields and position)
- the game-entity gets passed to Unity in addition to the provided database-entity-id
- Unity looks up the database-entity-id and instantiates a new gameobject
- additional MonoBehaviours on the gameObject add components to the game-entity