Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

Bug NetworkObject GlobalObjectIdHash changes when in prefab isolation mode

Discussion in 'Netcode for GameObjects' started by Yoraiz0r, Aug 3, 2023.

  1. Yoraiz0r

    Yoraiz0r

    Joined:
    Apr 26, 2015
    Posts:
    97
    I recently started using Netcode for Gameobjects, and noticed that I ended up with 2 prefabs that have the same hash.

    After some investigation, I found that the hash gets corrupt if you use prefab isolation mode to edit the prefabs.

    Specifically, GlobalObjecIdHash is just hashing the value of
    var globalObjectIdString = UnityEditor.GlobalObjectId.GetGlobalObjectIdSlow(this).ToString();

    But this method is returning the same value for any object in prefab isolation mode.
    Specifically, it always returns
    GlobalObjectId_V1-0-00000000000000000000000000000000-0-0


    I have two prefabs that somehow ended up serializing these values instead of their in-project-view values.

    What can be done to avoid this? I am using NGO 1.5.1 and Unity 2023.1.3f1
     
  2. TS-Trooper

    TS-Trooper

    Joined:
    Apr 30, 2019
    Posts:
    20
    Did you ever find an answer? I am finding it increasingly annoying
     
  3. Yoraiz0r

    Yoraiz0r

    Joined:
    Apr 26, 2015
    Posts:
    97
    I've long since reported this on the Netcode for Gameobjects github repository and it has since been fixed. The editor will still display the wrong values but will serialize them correctly.

    You can see the issue here: https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/issues/2653

    Depending on which version of NGO you're using, an update may resolve it (though potentially it may also bring new bugs)