Objects with the CoherenceSync
component can be connected to other CoherenceSync
components with a parent-child relationship. For example, an object can be linked to a hand, a hand to an arm, and the arm to a spine.
When and object has a parent in the network hierarchy, its transform (position and orientation) will update in local space, which means its transform is relative to the parent's transform.
A child object will only be visible in a LiveQuery if its parent is within the query's boundaries.
Creating an entity hierarchy is very simple. All you need to do is to add a GameObject with a CoherenceSync
component as a direct child of another GameObject with a CoherenceSync
component. You can add and remove parent-child relationships at runtime (even from the editor).
Sometimes, it is not practical to add CoherenceSync
objects to all the links in the chain. For example, if a weapon is parented to a hand controlled by an Animator, we do not need to synchronize the entire skeleton over the network. We will provide a helper script for such cases.