com.unity.netcode.gameobjects: NetworkPrefab has a duplicate GlobalObjectIdHash source entry value of XYZ
Describe the bug: Every now and then, I get this issue when trying to enter play mode:
NetworkPrefab (Example1) has a duplicate GlobalObjectIdHash source entry value of: 951099334! Removing entry from list! NetworkPrefab (Example2) has a duplicate GlobalObjectIdHash source entry value of: 951099334! Removing entry from list! NetworkPrefab (Example3) has a duplicate GlobalObjectIdHash source entry value of: 951099334! Removing entry from list!
It seems to happen with some of the prefabs in my network prefabs list. To fix it, I just revalidate the NetworkObject component (e.g., toggle one of the parameters on and off), and another GlobalObjectIdHash is generated. I tried completely removing and re-adding the NetworkObject components from each of the prefabs, however, it didn’t seem to work.
To reproduce: I unfortunately cannot seem to deterministically reproduce this error.
Screenshot:

Environment:
- OS: Windows 10
- Unity Version: 2020.3.12f1
- Netcode Version: 1.0.0-pre.3
- Unity Transport Version: 1.0.0.-pre.10
- Transport for Netcode Version: 1.0.0-pre.3
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 1
- Comments: 35 (15 by maintainers)
@tbillington You should be able to disable domain reloading with the up-coming v1.7.0 update.
Appreciate the detailed reply Noel, cheers.
@tbillington It depends upon what kind of development iterations you are doing:
The domain reload is required if you add or change NetworkVariables, Rpcs, or any form of custom serialization (i.e. INetworkSerializable) as there is an ILPP pass that needs to occur which injects code into the rebuilt DLL(s). Really it is a good idea to have the domain be reloaded if any underlying NetworkBehaviour logic changes.
Regarding the generation of the GlobalObjectIdHash value, this is specific to NGO (basically how network prefabs are uniquely identified) and has no impact on Netcode for Entities or UTP.
Ahh… yeah there have been several updates since v1.3.1 that might avoid some of the issues you are encountering. ParrelSync has been known to cause issues with prefabs and getting out of synchronization with the primary editor instance (editor that you are making changes to a prefab within).
I was diverted to a different issue yesterday so I haven’t had a chance to get back to this bug search… but will definitely post a link to the branch once I have pushed it to the repository. 👍
I’m following this issue with interest as the
951099334issue is happening more frequently for us now. For now we’ve bypassed the issue by adding a button to call OnValidate on all our NetworkObjects.I’ve always seen this on our parrelsync clone, however just this morning every prefab in the main editor project was
951099334for one of our team members.I’ve added some prints this morning to
GenerateGlobalObjectIdHashto see what is going on, but there’s not much of a stack withOnValidateunfortunately.Some interesting tidbits from prints so far:
OnValidateseems to be called twice for each changed NetObj, most of the time, when doing a refresh on the parrelsync clone. The first time it gets the951099334value, but then it gets called again with the proper value.OnValidatecall, but it was the correct value.I’ll let you know if/when I get the failure case.
@zachstronaut 951099334 is the “not assigned” GlobalObjectIdHash… which I have seen some (more recent) odd behaviors with GlobalObjectIdHash. I am looking into this issue currently, but it might be a few days before I get to the core issue.
Confusing bug… I’m not sure really why sometimes I’ve run into the “duplicate GlobalObjectIdHash” error message as noted in the original post.
@Laumania @NoelStephensUnity I can give you a bit of an update on why we all get the hash 951099334:
That’s the hash of “GlobalObjectId_V1-0-00000000000000000000000000000000-0-0” which is sometimes returned by
UnityEditor.GlobalObjectId.GetGlobalObjectIdSlow(this).ToString();for some reason, even though if you also logthis.gameObject.nameyou get a real object from your scene.I do have prefab variants (but those are not the only prefabs affected) and I am using additive scene loading.
In general, something about using
OnValidatefor this seems fishy? What am I missing? I would really only want one GUID ever generated for an object, right? I wouldn’t want it to keep getting regenerated?Update:
Okay, to further add to my own confusion about this subject, it seems like Prefabs in the NetworkPrefabs list are actually all saved to file with a GlobalObjectIdHash of 951099334 instead of an unique id? So is that by design? Whatever you see in the Editor is not what’s serialized to the .prefab file on disk. That id of 951099334 actually seems to represent “none” or “no ID”?
It seems like previously some of my prefabs with NetworkObjects were being written to disk with a real unique ID rather than the 951099334 and now that my prefabs are serialized on disk as 951099334 everything seems to be working correctly.
I’m really kind of perplexed now at what was causing this issue in the first place and how I solved it.
@NoelStephensUnity That solved the issue for me! It’s no problem if this issue doesn’t get fixed in the short term.
wlwl2 We do use the GetGlobalObjectIdSlow method during the validation period which only regenerates the GlobalObjectIdHash value if there is a change, if the script is being loaded, when entering into play mode, and when building a stand alone build.
There is a known issue where if the Reload Scene is unchecked via Project Settings->Editor->Enter Play Mode Options then this can cause issues with that unique identifier not being generated. So, always make sure that is the default (both darked out and appear unchecked) in order to assure the scene is reloaded when entering play mode.
I have also seen this bug happen when using some form of bootstrap scene loader that directly loads a scene using the SceneManager as opposed to using EditorSceneManager.OpenScene followed by EditorApplication.EnterPlaymode() , which the former way (SceneManager) skips the GlobalObjectIdHash generation that occurs within the editor context where the later way (EditorSceneManager.OpenScene) assures the GlobalObjectIdHash generation occurs before entering into play mode.
The bottom line is that if the editor scene reloading that occurs when entering into play mode is disabled or bypassed it could cause this issue to arise. For the near future up-and-coming update, I don’t think this will get fixed. However, I will start looking at that section of the code and our current GlobalObjectIdHash generation process to see if I can come up with a better way to handle when that value is generated.
Thanks @NachtAktivist. For a quick workaround, I’ve attached a component to my startup scene that toggles a property from each network prefab twice…
Silly workaround, but this issue has been incredibly frustrating, so just glad I don’t have to worry about it again.