Is there a good way to find what networkObject is trying to be spawned?

Hey all,

I have an error but I’m finding it hard to trace. I’m assuming I am missing a prefab from my DefaultNetworkPrefabs list but im struggling to find what item it is.

Is there a way to find what object has a particular globalObjectIdHash?
[Netcode] Failed to spawn NetworkObject for Hash 4122478787.

Yeah, that is a tough thing to find since it happens on the client side of things.
I have attached some helper tools that I have been working on that you might find useful.
You will want to select the tools->Netcode->NetworkObject Finder.
This will present a window where you can basically paste the GlobalObjectIdHash value and hit the “Find NetworkObject” button.


Once you hit that, if it is a network prefab (i.e. prefab with a NetworkObject at the root) then it should select the asset in your project:

That might help you find things faster when that happens.
Of course, if it doesn’t find anything then it would be an in-scene placed NetworkObject… but that should log a “soft synchronization” error on the client side.

Let me know if that helps you track down the missing network prefab?

Hey, You mentioned you attached a tool, but I cant see it

Sorry about that… here is the tool script.

9494218–1336759–NGOTools.zip (2 KB)

1 Like

Hmm its getting this error on PrefabIdHash check?

Do I need to be running or something?

Found it! Legend, thanks, that tool works a treat <3 I just needed to be running my game (to instantiate the networkmanager singleton) Have a nice day <3

Just wanted to say thank you! Really helpful!

I am getting the error Scene Hash 1671945132 does not exist in the HashToBuildIndex table and I entered the hash in the object finder, but it finds nothing.

How can I find the scene that belongs to this hash?

Thanks!

@joostbos

There isn’t currently an easy way to get that reverse look up, but this does typically mean you have loaded and/or are loading a scene that is not included in the scenes in build list.

However, could you describe the scenario when this occurred?

If you are using the most current version of NGO (v2.5.1) and using MPPM, then it is most likely a known issue where under certain conditions you can enter into play mode and the virtual client does not properly synchronize and/or loses the scenes in build list which will cause that error message.

Thanks for your reply. The issue seem to be caused because I tested with the old Windows version and the new Android version (see also my other post Netcode for GameObjects cant find my Scene but only when using Multiplayer Play Mode - #7 by joostbos ). The Android scenes are not in the Windows build list and vice versa. When I ran both the server and the client on Android ths issue no longer occurred.

But what’s confusing (and frustrating :smiley: ) is that it is not consistent. My solution is based on the Serverless lobby multiplayer example and for the lobby scenes mixing old and new was no problem at all. I could see both the Windows player or host and the Android player or host in the lobby. But when the players were ready and the “game” started this error came up.

Below is an overview of the scene names in the build. The ones in green work fine, the ones in red cause the problem. Note that my solution is not a game where host and players are in the same scene and can see eachother. I am using networking to exchange information between multiple clients and a dashboard on the server. Therefore I have a common scene for exchanging the information and then dedicated scenes for the server and the client.

I hope this gives you some background.

Netcode for GameObjects works by traversing the scene list on the initial synchronize and then when a scene is loaded, the scene hash is sent to all clients and the clients will grab the scene with that hash and load that. When you load one scene on the server and a different scene on the client, the server will be sending the scene hash of the server scene. If that scene doesn’t exist on the client, then you will scene the error you are reporting here.

It is possible to write your own scene manager so that you have control over how that process works. But at this time, the default Netcode for GameObjects manager requires that the same scenes exist on the server and on the client builds.

To add to what Emma posted, you might want to take a look at the Overriding Scenes and Prefabs example if you want client or server specific scenes that are just always loaded by default.

!! Note:
Scenes that are loaded locally (i.e. SceneManager and not NetworkSceneManager) in this way will not be synchronized which means placing any netcode related assets in those scenes will not work. However, there is an example of how to “hook” into a known “middle-man” NetworkBehaviour to allow non-netcode classes use it for different types of synchronization.

That example might provide you with some insights as to how you might be able to achieve your project’s goals.

Thanks! I’ll have a look at it.