Search Unity

Asset Bundle's lose Network Identity Asset ID required for uNet spawning, Nested Prefabs

Discussion in 'Asset Bundles' started by Phedg1, Jan 17, 2019.

  1. Phedg1


    Mar 3, 2015
    The game I'm working on has the expectation that players will be able to download the source code, open it in Unity and create their own levels using premade prefabs. Those levels will then be saved as nested prefabs in asset bundles. The hope is that users will then be able to share those asset bundles with each other in order to play networked games together in the levels they've made and shared.

    However, when a level prefab is built into an asset bundle it seems the NetworkIdentity.assetId NetworkHash128 property isn't serialized and is lost, causing errors the error "Failed to spawn server object, did you forget to add it to the NetworkManager?" when the client joins the server. Saving the assetId as a string on the prefab and registering the prefab with ClientScene.RegisterPrefab(levelPrefab, NetworkHash128.Parse(assetIdString)) will get around this, allowing the levels to be loaded on the client. However, every networked prefab that's part of the level nested prefab seems to have no observers. This doesn't cause any errors because the level prefab was spawned successfully.

    The game is almost finished and is built around the uNet framework. I know it's been depreciated but Unity hasn't released an alternative which is just plain frustrating. Can anyone help? Thanks.
    Last edited: Jan 17, 2019
    Sam-DreamsMaker likes this.
  2. Sam-DreamsMaker


    May 2, 2015
    Same for me
  3. Ryanc_unity


    Unity Technologies

    Jul 22, 2015
    "download the source code, open it in Unity and create their own levels using premade prefabs"

    Where do the premade prefabs come from? Are you downloading a *.unitypackage with the source premade prefabs, or are you trying to use data loaded from an asset bundle?