Often in games different objects interact with each other, eg. a button opens a door, a child follows its parent etc. With the new ESC system those hierarchies aren’t trivial, hierarchies don’t really exist natively. So how do we link entities in a hierarchy?
Linking entities as a group
In the new ESC if you translate a GameObject via
ConvertToEntity to entities the hierarchy would not be translated into the ESC World. The simple solution to this is called
LinkedEntityGroup. This translates the hierarchy to ESC land.
LinkedEntityGroup is a Buffer which can be used to link the lifetime of entities together. This buffer takes an entity as reference point (root) and when this one gets destroyed all the linked entities get destroyed as well.
The following example demonstrates the usage of the