Multiple parents for coherence nodes in the same hierarchy cause problems

Hello! First of all thank you for your awesome SDK.

I’m making some prototyping and I’m facing a use case that I don’t know if is a bug or a not possible use case.

I’m parenting some objects with the “Coherence Node” component. An image from the root “Coherence Sync” object:

When I parent object in one of the childs all works fine like the following image (notice the other object are disabled)

But when I enable a second group of “Coherence Node” childs in another parent from the same “root object hierarchy” all stop failing and [Sync] tags and synced properties (configured through the editor) stop working.

There is also an error in the room log:

I’m doing something wrong? Is this use case not possible? or There is a bug?

Thank you in advance and have a nice day!

1 Like

Hey mameshibagames!

Thanks for reporting this, it definitely looks like a bug handling complex hierarchies in the replication server.

Are you creating a nested prefab? It looks like the PushButtons instances of another prefab that also have a CoherenceSync component.

Do you get the error immediately when you press Play with an instance in the scene, or do you need to do some re-parenting in runtime?

Nested prefabs with multiple CoherenceSync components are currently not supported with coherence.
I’d recommend you try to decouple your prefabs and connect them in runtime.

See also:
4. Parenting entities - Unity Multiplayer SDK Documentation | coherence
5. Complex hierarchies - Unity Multiplayer SDK Documentation | coherence

Hello Mathias,

Thank you for the awesome fast response.

Yes is a nested prefab only in the scene (not saved in assets but it is).

I’ve tried reparenting at runtime (quick note: I made the reparenting after the OnSync event, becouse if I do on Start for example, same behavior happen). But still some strange problems.

Here the example:
With the setup in this image work (only reparenting at runtime one group of elements).

But when I try to reparent two group of objects, like in the following imagen:

Doesn’t work for me. In this case no error in the Room Log, but the second player is unable to connect to the room.

The reparenting code:

    private void Awake()
        _sync.CoherenceBridge.ClientConnections.OnSynced += Reparent;

    private void Reparent(CoherenceClientConnectionManager obj)
        if (!_sync.HasStateAuthority) return;

If you need more info, please feel free to ask.

Sorry quick note about this part:

“Doesn’t work for me. In this case no error in the Room Log, but the second player is unable to connect to the room.”

Sometimes the second client doesn’t connect but when it connects (slower than usual) [sync] attribritutes (and configured ones like rotation) doesn’t work and are not being synced, even if are from another Coherence Sync not involved in the parenting.

Alright, thanks for clarifying the issue! I don’t have an immediate answer, but we’re going to try to reproduce it on our end and figure out what is going on.

Which coherence version are you using?

Hello Mathias!

I started the project with the 0.10.15 and the past week I update to the 1.0.3 version, making the proper changes for the deprecated components.

If you need more info or a minimal version of the project with the use case just let me know.

Have a nice day!

A minimal repro would actually be very helpful!

Hello again Mathias!

Here you have a minimal project to repro.

It was very tricky to catch so here some considerations:

  • The bug happens parentin prefabs with coherence sync and coherence node into another prefab with coherence sync. You need to parent same objects (10 or more in my test) sync a property in the parent (I sync the rotation) and changing that property by script (See Rotator object).
  • That cause a failure that other objetcs stop sync (but commands works, at least in the full project).

Here the image with the full setup:

The “OtherSyncedObject” has a float [Sync] property that not sync in the 2º connection with the bug.

Now my discoveries (take with care because I’m not sure 100%):

  • If the child objects are <= 9 it works.
  • If you remove the Object To Rotate in the Rotator (not changing the rotation from the parent) it works.
  • If you launch first from editor (instead from build) making the editor take the state authority it works.
  • If you don’t sync the rotation in the parent it works.

Hoping with this information you can take it!

Have a nice day!

1 Like

Thanks a lot for the repro!

We’re pushing this into our pipeline now and trying to figure out what’s going wrong.
Might take a little while though, so I hope this is not completely blocking your work.

Quick test of your project without any changes (except I added parrelsync for side-by-side testing).

All 10 child-objects seem to be parented correctly into the hieararchy from what I can tell, and rotate as expected. And the number on the OtherSyncedObject seems to increment too.

Are you getting a different result on your end?

Is probably working for you (both counters synced) because like I pointed at my discoveries If you launch from the editor all works fine. The bug happen when you launch first from a build.

Also making a quick test and the bug only happens if I use the cloud server. Local Replication server make it works fine. I’m shocked with this strange behaviour! :upside_down_face:

Here a video with the error happening:

Ok so I am seeing some very strange behaviour now.

The initial connection to the server is usually very fast, but the actual syncing of scene data takes ridiculous amounts of time, even over a minute in one test. It is only after the scene has synced that you’ll see the objects correctly parented in the editor.

I continue investigating what is going on. Unfortunately I cannot repro it locally and the cloud logs aren’t helping me this time.

1 Like

Hey! We’ve tracked down the parenting bug and there’s already a patch waiting for release but it may take some while to make it through our QA and release process.

Do you have any workaround for this in the meantime?


Hello Mathias!

Awesome news! No worry, we are working on other parts of the prototype and we are not blocked by this so take your time to ship it with the proper QA and all.

Thank you very much for all your help! I stay tuned for the patch.

Have a nice day!


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