Search Unity

  1. Unity 2019.1 beta is now available.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. We're looking for insight from anyone who has experience with game testing to help us better Unity. Take our survey here. If chosen to participate you'll be entered into a sweepstake to win an Amazon gift card.
    Dismiss Notice
  4. On February 28th the Feedback website will shut down and be redirected to the Unity forums. See the full post for more information.
    Dismiss Notice
  5. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  6. Unity 2018.3 is now released.
    Dismiss Notice
  7. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

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

    Phedg1

    Joined:
    Mar 3, 2015
    Posts:
    100
    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

    Sam-DreamsMaker

    Joined:
    May 2, 2015
    Posts:
    13
    Same for me
     
  3. Ryanc_unity

    Ryanc_unity

    Unity Technologies

    Joined:
    Jul 22, 2015
    Posts:
    165
    "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?