Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

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:
    78
    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