CoherenceSync not parenting across network

hierarchyCoherence

Above image shows my hierarchy from one of the clients (Client A) when there are two players connected. The green arrows show the objects PlayerActions and CharacterActions belonging to Client A. The red arrows show the objects PlayerActions and CharacterActions belonging to connected Client B. CharacterActions is supposed to have PlayerActions as parent.

For some reason, Coherence sets the parent of PlayerActions to PlayerManager correctly, but it does not set the parent of CharacterActions to PlayerActions, despite the parent being set locally.

It does not matter if the CharacterActions object is instantiated before or after connecting to the server.

Let me know what other information you might need.

1 Like

I’ll check with the SDK team as to why this might be happening…

In the meantime, why is _Character a unique, synced prefab of its own? Wouldn’t it make more sense to just nest it inside _PlayerActions, and let that CoherenceSync do the work? So that it’s one network entity.

After all, I imagine they are instantiated and removed together (?)

1 Like

PlayerActions is persistent as long as the person is playing, whereas Character can get destroyed and reinstantiated many times during the game



In case it’s relevant, here are my CoherenceSync settings for PlayerManager, PlayerActions and Character.

I see.

In any case, I’ve asked the SDK team, and (as I was expecting) there is no limit to have a parenting chain of 3-4-5… entities, so that’s not the issue.

I’ll look at the images now!

I think the setup as shown in the last images is correct - or, there’s nothing that could be causing the issue.

Do you get any warning in the console?

And, question: are you aware of OnLiveQuerySynced and how to use it?

Could it be that the objects are performing some operations when they have connected, but haven’t received OnLiveQuerySynced yet? So they are working with a network picture that is not fully synced… ?

What you suggest isn’t impossible that I may have some oversight, but I don’t know which operations would affect the parent…

I have the same issue when instantiating another prefab (Spear), so I tried removing all scripts from that one, keeping CoherenceSync and CoherenceNode. No difference. Parent still null on other clients.

I tried instantiating it with the same parent as “TutorialSteps” whose parent is for some reason synced correctly. No difference.

I tried using the exact same method signature for instantiating spear as I do for TutorialSteps:

return GameObject.Instantiate(go, position.Value, rotation.Value, parent);

No difference.

I tried removing any code affecting spear on the owner after instantiating. No difference.

I considered that maybe it has to do with some CoherenceSyncs being set to “No Duplicates” (such as the one on _Stages, TutorialSteps, PlayerManager) since they are correctly parented. But PlayerActions allows duplicates, yet that one is correctly parented too, though CharacterActions and Spear (also allowing duplicates) is not.

I considered maybe it’s that they have a Rigidbody2D, but removing that made no difference.

In the place where I instantiate TutorialSteps, I tried making it instantiate the Spear prefab instead and… the Spear still has null parent on other clients. So something with the prefab? I have no idea.

Would you be happy sharing this prefab and the scene it’s in? I could take a look at what is happening.

If so, I think the best way is to either share the whole project, or to export the scene as a .unitypackage and choose to export dependencies.

Let me know, in case I’ll provide an email address to send it to via PM.

I feel a bit unsafe sending the whole project, and uncoupling the scene from the rest of the game would take quite a lot of time, so for now I’d like to try to just work around it, and if it continues to bother me or I change my mind, I’ll get back to you

1 Like

No problem! Yeah I wasn’t sure of the size or state of the project. Let me know if I can help later then.

1 Like

Thank you very much <3

1 Like

@thefamousderpshark just checking in to see how you’re getting on.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.