Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Nested Prefabs networked not connecting

Discussion in 'Prefabs' started by Phedg1, Jan 17, 2019.

Thread Status:
Not open for further replies.
  1. Phedg1

    Phedg1

    Joined:
    Mar 3, 2015
    Posts:
    113
    So, after spending a bunch of time replacing my scenes with nested prefabs for my networked game, I have just found that networked child prefabs of a prefab don't actually sync or connect over the network. It seems that networked prefabs that are the child of other networked prefabs are instantiated on clients, not spawned. Only the top level gameobject is spawned. I really don't know how I can move my project forward like this.
     
    Last edited: Jan 17, 2019
  2. Phedg1

    Phedg1

    Joined:
    Mar 3, 2015
    Posts:
    113
    Iterating through and spawning all the child prefabs of the top level prefab spawns multiple of the top level prefab on all clients, presumably because all child prefabs have the same asset id as the top level prefab. Asset id property cannot be changed on the server instance, meaning the asset id of the asset that will be spawned on clients will always been the asset id of the parent prefab.
     
    Last edited: Jan 18, 2019
  3. runevision

    runevision

    Joined:
    Nov 28, 2007
    Posts:
    1,892
    I can't help you with networking issues, but please note that nested Prefabs is a feature that only exists at edit-time. When making a build (or going in Play Mode) nested Prefabs are "baked" into their enclosing Prefabs. So if you're seeing any issues related to nested Prefabs at runtime, there is almost certainly some misunderstanding involved.
     
  4. Phedg1

    Phedg1

    Joined:
    Mar 3, 2015
    Posts:
    113
    Thank you. It helped me deduce that my issue is caused by nested NetworkIdentity components in uNet, not the nested prefab system. Sorry. I have created another thread here:

    https://forum.unity.com/threads/how...ed-networkidentity-components-in-unet.614746/

    I am still at a complete loss as to how to tackle this issue and help in the uNet system is becoming hard to come by. Is there any chance you might know another team member who is familiar with the framework who might be able to lend me some assistance?
     
Thread Status:
Not open for further replies.