The SpatialOS GDK for Unity provides functionality to develop games in both of Unity’s paradigms:
- Object-oriented: MonoBehaviours and GameObjects
- Data-oriented: Entity-Component-System (ECS)
You can stick to familiar MonoBehaviour-based development, check out the new ECS workflow, or try a combination of both.
However you choose to develop your game, it is important to understand what SpatialOS entities are and how they relate to each workflow.
In the GDK, SpatialOS entities can be linked to GameObjects by using the Game Object Creation Feature Module. Readers and Writers allow you to inspect and change the state of components on SpatialOS entities using MonoBehaviours that you add to their linked GameObjects.
You may find that not all SpatialOS entities need to be represented as GameObjects. The Game Object Creation Feature Module allows you to customise the GameObject creation and linking process.
ECS is an architectural pattern adopted by Unity in early 2018, allowing you to design your Unity game in a data-oriented fashion.
In the GDK, each SpatialOS entity checked out by a worker has a corresponding ECS entity. To inspect or change the state of components on SpatialOS entities, you must read or write to the components on corresponding ECS entities.
To learn more about ECS, check out: