# CoherenceSync not parenting across network

**URL:** <https://community.coherence.io/t/coherencesync-not-parenting-across-network/386>\
**Category:** Help\
**Created:** [October 23, 2023, 1:49pm UTC](https://community.coherence.io/t/coherencesync-not-parenting-across-network/386 "2023-10-23T13:49:01Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![thefamousderpshark](https://dub1.discourse-cdn.com/flex017/user_avatar/community.coherence.io/thefamousderpshark/32/389_2.png) [@thefamousderpshark](https://community.coherence.io/u/thefamousderpshark)\
**Post date:** [October 23, 2023, 1:49pm UTC](https://community.coherence.io/t/coherencesync-not-parenting-across-network/386/1 "2023-10-23T13:49:01Z")

</div>

![hierarchyCoherence](https://europe1.discourse-cdn.com/flex017/uploads/coherence/original/1X/66a6bd674b9a1cbc967b5015ed68a69879f6b2db.png)

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.

---

<div class="post-metadata">

**Author:** ![ciro](https://dub1.discourse-cdn.com/flex017/user_avatar/community.coherence.io/ciro/32/82_2.png) [@ciro](https://community.coherence.io/u/ciro)\
**Post date:** [October 23, 2023, 2:03pm UTC](https://community.coherence.io/t/coherencesync-not-parenting-across-network/386/2 "2023-10-23T14:03:08Z")

</div>

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 (?)

---

<div class="post-metadata">

**Author:** ![thefamousderpshark](https://dub1.discourse-cdn.com/flex017/user_avatar/community.coherence.io/thefamousderpshark/32/389_2.png) [@thefamousderpshark](https://community.coherence.io/u/thefamousderpshark)\
**Post date:** [October 23, 2023, 2:39pm UTC](https://community.coherence.io/t/coherencesync-not-parenting-across-network/386/3 "2023-10-23T14:39:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![thefamousderpshark](https://dub1.discourse-cdn.com/flex017/user_avatar/community.coherence.io/thefamousderpshark/32/389_2.png) [@thefamousderpshark](https://community.coherence.io/u/thefamousderpshark)\
**Post date:** [October 23, 2023, 2:48pm UTC](https://community.coherence.io/t/coherencesync-not-parenting-across-network/386/4 "2023-10-23T14:48:56Z")

</div>

![PlayerManagerSync](https://europe1.discourse-cdn.com/flex017/uploads/coherence/original/1X/b9b367a6d7da5c6978a52e020b0449b53e5e61ec.png)  
 ![PlayerActionsSync](https://europe1.discourse-cdn.com/flex017/uploads/coherence/original/1X/fa89ba6b435a53cb6b2f2c1634d1f88a998b625e.png)  
 ![CharacterSync](https://europe1.discourse-cdn.com/flex017/uploads/coherence/original/1X/6658039518defefcfc4418e71b5084e5e802ca47.png)

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

---

<div class="post-metadata">

**Author:** ![ciro](https://dub1.discourse-cdn.com/flex017/user_avatar/community.coherence.io/ciro/32/82_2.png) [@ciro](https://community.coherence.io/u/ciro)\
**Post date:** [October 24, 2023, 10:27am UTC](https://community.coherence.io/t/coherencesync-not-parenting-across-network/386/5 "2023-10-24T10:27:44Z")

</div>

> [@thefamousderpshark](#):
>
> PlayerActions is persistent as long as the person is playing, whereas Character can get destroyed and reinstantiated many times during the game

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!

---

<div class="post-metadata">

**Author:** ![ciro](https://dub1.discourse-cdn.com/flex017/user_avatar/community.coherence.io/ciro/32/82_2.png) [@ciro](https://community.coherence.io/u/ciro)\
**Post date:** [October 24, 2023, 10:42am UTC](https://community.coherence.io/t/coherencesync-not-parenting-across-network/386/6 "2023-10-24T10:42:27Z")

</div>

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](https://docs.coherence.io/coherence-sdk-for-unity/components/coherencebridge#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… ?

---

<div class="post-metadata">

**Author:** ![thefamousderpshark](https://dub1.discourse-cdn.com/flex017/user_avatar/community.coherence.io/thefamousderpshark/32/389_2.png) [@thefamousderpshark](https://community.coherence.io/u/thefamousderpshark)\
**Post date:** [October 26, 2023, 1:55pm UTC](https://community.coherence.io/t/coherencesync-not-parenting-across-network/386/7 "2023-10-26T13:55:12Z")

</div>

![SpearHierarchy](https://europe1.discourse-cdn.com/flex017/uploads/coherence/original/1X/35959ca0be7ed35b1d6b79dc066e9223bdaa71eb.png)

 ![SpearHierarchyOwner](https://europe1.discourse-cdn.com/flex017/uploads/coherence/original/1X/a7cfa31a6a99cefdf02a5fa0bfccc5db4f903d60.png)

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:

```auto
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.

---

<div class="post-metadata">

**Author:** ![ciro](https://dub1.discourse-cdn.com/flex017/user_avatar/community.coherence.io/ciro/32/82_2.png) [@ciro](https://community.coherence.io/u/ciro)\
**Post date:** [October 27, 2023, 6:06am UTC](https://community.coherence.io/t/coherencesync-not-parenting-across-network/386/8 "2023-10-27T06:06:52Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![thefamousderpshark](https://dub1.discourse-cdn.com/flex017/user_avatar/community.coherence.io/thefamousderpshark/32/389_2.png) [@thefamousderpshark](https://community.coherence.io/u/thefamousderpshark)\
**Post date:** [October 31, 2023, 3:36pm UTC](https://community.coherence.io/t/coherencesync-not-parenting-across-network/386/9 "2023-10-31T15:36:08Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ciro](https://dub1.discourse-cdn.com/flex017/user_avatar/community.coherence.io/ciro/32/82_2.png) [@ciro](https://community.coherence.io/u/ciro)\
**Post date:** [November 1, 2023, 7:17am UTC](https://community.coherence.io/t/coherencesync-not-parenting-across-network/386/10 "2023-11-01T07:17:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![thefamousderpshark](https://dub1.discourse-cdn.com/flex017/user_avatar/community.coherence.io/thefamousderpshark/32/389_2.png) [@thefamousderpshark](https://community.coherence.io/u/thefamousderpshark)\
**Post date:** [November 1, 2023, 11:05am UTC](https://community.coherence.io/t/coherencesync-not-parenting-across-network/386/11 "2023-11-01T11:05:11Z")

</div>

Thank you very much \<3

---

<div class="post-metadata">

**Author:** ![per\_coh](https://dub1.discourse-cdn.com/flex017/user_avatar/community.coherence.io/per_coh/32/27_2.png) [@per\_coh](https://community.coherence.io/u/per_coh)\
**Post date:** [November 9, 2023, 9:55am UTC](https://community.coherence.io/t/coherencesync-not-parenting-across-network/386/12 "2023-11-09T09:55:59Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://europe1.discourse-cdn.com/flex017/uploads/coherence/original/1X/b3aa79eb9519fac7aad7eba18f15a1e8ce60f6e2.png) [@system](https://community.coherence.io/u/system)\
**Post date:** [February 7, 2024, 9:56am UTC](https://community.coherence.io/t/coherencesync-not-parenting-across-network/386/13 "2024-02-07T09:56:40Z")

</div>

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