CoherenceNode
While the basic case of direct parent-child relationships between entities is handled automatically by coherence, more complex hierarchies (with multiple levels) need a little extra work.
An example of such a hierarchy would be a synced Player prefab with a hierarchical bone structure, where you want to place an item (e.g. a flashlight) in the hand:
Player > Shoulder > Arm > Hand
A prefab can only have a single CoherenceSync
script on it, so you can't add an additional one to the hand. In this case you need to use the CoherenceNode
component. To do so, follow these steps:
Add the
CoherenceNode
component to your child prefab. In the example above, that would be the flashlight you want your player to be able to pick up.Select the two fields
path
andpathDirtyCounter
for syncing.
You don't need to do any changes to the Player prefab, just make sure it has a CoherenceSync
script in the root.
This setup allows you to place instances of this prefab anywhere in the hierarchy of another synced object. The one important constraint is that the hierarchies have to be identical on all clients.
Last updated