Search Unity

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

Resolved Issue with Player prefab hash

Discussion in 'Netcode for GameObjects' started by chummscrubber, Jun 17, 2022.

  1. chummscrubber

    chummscrubber

    Joined:
    Jul 7, 2013
    Posts:
    6
    When I connect to a host server as a client I am getting the following error:
    NetworkPrefab hash was not found! In-Scene placed NetworkObject soft synchronization failure for Hash
    .

    upload_2022-6-17_17-14-56.png

    I have tried deleting and recreating the player prefab, but I still see the issue. I am using Unity Transport

    upload_2022-6-17_17-13-19.png

    upload_2022-6-17_17-13-51.png
     
  2. Jicefrost

    Jicefrost

    Joined:
    May 13, 2019
    Posts:
    40
  3. chummscrubber

    chummscrubber

    Joined:
    Jul 7, 2013
    Posts:
    6
    I managed to solve it, I found I was using a network object on something that was a monobehaviour (the UI manager), removing it fixed the error.
     
    Pandazole, GuirieSanchez and lukasz13 like this.
  4. GuirieSanchez

    GuirieSanchez

    Joined:
    Oct 12, 2021
    Posts:
    405
    @chummscrubber would you mind elaborating on that? I got 7 pairs of these
    upload_2023-2-10_0-34-8.png

    And I have no idea what they are referring to honestly, as they aren't pointing to any object specifically on the error message.
    And I don't know what you mean by "using a network object on something that was a monobehaviour". Is it just a monobehaviour script attached to a network object, with no other script (that can be a networkbehaviour) attach to it? Having both types of scripts (mono-b and network-b) on a network object have some kind of interference on it?
     
  5. rhirne12

    rhirne12

    Joined:
    Nov 11, 2018
    Posts:
    1

    I was having this same problem as well and it took me a bit to figure out the issue. For those who need the answer:

    To find the object, look first at the Hash in the error message. This will tell you what Network Object you need to look at in your scene.

    Now here comes the fun part, finding the Object in the scene with that hash. The only way I found it was looking at each GameObject in my scene that was also a Network Object. Look at the Network Object in the Inspector, and you will see the GlobalObjectHash - this is was the error is referencing.
    upload_2023-6-28_11-1-31.png


    You then need to check your scripts on that parent and child objects. For me, I found that I had a script on a child object that was using MonoBehaviour, but it needed to be using NetworkBehaviour. That one script was producing 5-6 different hash errors. Once I changed the script, all of the errors disappeared. The other scripts on the child objects that used MonoBehaviour were fine; just that one script needed NetworkBehaviour.
     
  6. MariusBaud

    MariusBaud

    Joined:
    Jun 1, 2022
    Posts:
    8
    I found the object that gave me this error but the script that is attached to the object is already a networkBehaviour and there is no child on this object ( this is a prefab that is spawned by the host and it give me this error on the client ). Any idea ?
     
  7. KadaXuanwu

    KadaXuanwu

    Joined:
    Oct 26, 2019
    Posts:
    9
    If you have placed a prefab in the scene, and added the NetworkObject manually in the scene, make sure to apply these changes to the prefab itself. It solved the error for me.
     
  8. Giantbean

    Giantbean

    Joined:
    Dec 13, 2012
    Posts:
    144
    I have been through every hash in the project nd the one mentioned in my error dosent exist?