(IN-59482) [1.1.0-exp.1] Received a ghost from the server which has a different hash on the client

Case IN-59482

It’s not working again at client player runtime build that it just log Received a ghost - xxx - from the server which has a different hash on the client (got xxx but expected xxx). GhostPrefab: Unity.Entities.Entity (‘’) error when client player runtime build trying to connect to server. I spend a lot of time to debug the issue but still can’t find the root cause. It’s weird that this test project is not working properly but it’s working at my another actual game project

Update:
I also able to repro the similar bug at my actual game project but it’s already log the error at editor before I build player runtime.

Hi @CMarastoni and @NikiWalker . This issue is still not fully solved yet until latest 1.1.0-exp.1. Seems like needs to to rewrite a truly deterministic hash generation solution to make sure both client and server ghosts always can get the same hash.

The hash is deterministic and it get different only if you don’t do something deterministic usually or there is a bug somewhere.
Everything is calculated using a deterministic approach (sorting etc etc). If you have a repro, submit the case and I will be very happy to add:

  • more debug log (of course)
  • checking what it is going on.

If the same case still cause the problem, I will start from there.

1 Like

Case IN-59482

Thanks!!1

Hi @CMarastoni ,

Have there been any updates on this particular bug? I am getting it for my Web build. The first error I get is

Client.framework.js:2192 Received a ghost - PrespawnSceneList - from the server which has a different hash on the client (got 4203268204611306009 but expected 14879859698015659120). GhostPrefab: Entity(297:1) (‘PrespawnSceneList’).

And then a lot of the same error for different entities throughout my scene. It looks like it is mainly for ghost entities that I add into components as prefabs that can be called from my scripts. E.g. they get assigned in bakers.

Really lost on how to debug this one!

Here is a link to the case: Unity Issue Tracker - Ghost Hash from the Server side doesn't match the Ghost Hash on Client side

1 Like

I’ve taken a look at the resolution but how do I do the following?

If you remove the UNITY_EDITOR ‘Define Constraint’ from the Ghost.Variant.Authoring assembly or move the GhostComponentVariations contained within to an assembly which is included in the build this will fix the issue.

Where is the Ghost.Variant.Authoring assembly and GhostComponentVariations?

I’m getting this error on Netcode 1.3.6. I can connect between the editor and player builds freely without errors, but I cannot connect to a dedicated server build.

Received a ghost - PlayerCharacter - from the server which has a different hash on the client (got 3351642428655035069 but expected 8553487280260002993). GhostPrefab: Unity.Entities.Entity ('PlayerCharacter').
Received a ghost - EnemyCharacter - from the server which has a different hash on the client (got 14383368116326441969 but expected 6887673599008973071). GhostPrefab: Unity.Entities.Entity ('EnemyCharacter').
Received a ghost - PrespawnSceneList - from the server which has a different hash on the client (got 14860726575697299159 but expected 9499226459843269033). GhostPrefab: Unity.Entities.Entity ('PrespawnSceneList').
(all other ghost prefabs follow)

I’m not blocked by this currently and sadly I don’t currently have much time to debug. My setup is rather basic, so it’s weird that this would desync.

Could this be related to my build script? Is building servers using subtarget = 1 supported? Do I need the com.unity.dedicated-server package? (I am launching the editor with -buildTarget win64 -standaloneBuildSubtarget Server).

UnityEditor.BuildPipeline.BuildPlayer(new UnityEditor.BuildPlayerOptions
{
    scenes = UnityEditor.EditorBuildSettings.scenes.Select(x => x.path).ToArray(),
    locationPathName = "Build/game.exe",
    target = UnityEditor.EditorUserBuildSettings.activeBuildTarget,
    subtarget = 1,
    options = options,
});

It is possible that is due to the build script. Something like PrespawnSceneList (that is a basic buffer of things) to fail hash validation may imply that the current assigned serializers (that all together forms the bulk of the hash calculation) are different.
If you can share your setup we can also dig into it to see what we can improve to help detecting this.