Search Unity

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

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

Discussion in 'Netcode for GameObjects' started by Tsunamisukoto, Nov 20, 2023.

  1. Tsunamisukoto

    Tsunamisukoto

    Joined:
    Apr 21, 2023
    Posts:
    16
    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.
     
  2. NoelStephens_Unity

    NoelStephens_Unity

    Unity Technologies

    Joined:
    Feb 12, 2022
    Posts:
    244
    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.
    upload_2023-11-20_8-42-8.png
    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:
    upload_2023-11-20_8-44-34.png

    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?
     
  3. Tsunamisukoto

    Tsunamisukoto

    Joined:
    Apr 21, 2023
    Posts:
    16
    Hey, You mentioned you attached a tool, but I cant see it
     
  4. NoelStephens_Unity

    NoelStephens_Unity

    Unity Technologies

    Joined:
    Feb 12, 2022
    Posts:
    244
    Sorry about that... here is the tool script.
     

    Attached Files:

  5. Tsunamisukoto

    Tsunamisukoto

    Joined:
    Apr 21, 2023
    Posts:
    16
    upload_2023-11-27_13-1-51.png

    Hmm its getting this error on PrefabIdHash check?
     
  6. Tsunamisukoto

    Tsunamisukoto

    Joined:
    Apr 21, 2023
    Posts:
    16
    Do I need to be running or something?
     
  7. Tsunamisukoto

    Tsunamisukoto

    Joined:
    Apr 21, 2023
    Posts:
    16
    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