Netcode for GameObjects is a high-level netcode SDK that provides networking capabilities to GameObject/MonoBehaviour workflows within Unity and sits on top of underlying transport layer.
MIT License
2.16k
stars
435
forks
source link
GlobalObjectIdHash contains invalid if networked prefab was edited from Prefab mode #3151
Whenever I edit Networked Prefab in Prefab mode (double click on prefab in project tool window), then attempting to establish connection between server & client fails with:
[Netcode] NetworkConfig mismatch. The configuration between the server and client does not match
UnityEngine.Debug:LogWarning (object)
Unity.Netcode.NetworkLog:LogWarning (string) (at ./Library/PackageCache/com.unity.netcode.gameobjects/Runtime/Logging/NetworkLog.cs:28)
Unity.Netcode.ConnectionRequestMessage:Deserialize (Unity.Netcode.FastBufferReader,Unity.Netcode.NetworkContext&,int) (at ./Library/PackageCache/com.unity.netcode.gameobjects/Runtime/Messaging/Messages/ConnectionRequestMessage.cs:169)
...
If I edit Networked Prefab outside of Prefab mode (single click on prefab in project tool window), then everything works as expected.
This also server as a workaround. Toggling any property on a prefab in this mode "fixes" error.
In general if you check GlobalObjectIdHash property for prefab, then it's different between these 2 views.
My observations:
Main editor always reads GlobalObjectIdHash correct & consistent value (one from "prefab mode").
Virtual Player (via MPPM) reads GlobalObjectIdHash from "prefab mode" if last saved from "regular mode"
Virtual Player (via MPPM) reads GlobalObjectIdHash from "regular mode" if last saved from "prefab mode"
Description
Whenever I edit Networked Prefab in Prefab mode (double click on prefab in project tool window), then attempting to establish connection between server & client fails with:
If I edit Networked Prefab outside of Prefab mode (single click on prefab in project tool window), then everything works as expected. This also server as a workaround. Toggling any property on a prefab in this mode "fixes" error.
In general if you check
GlobalObjectIdHash
property for prefab, then it's different between these 2 views.My observations:
GlobalObjectIdHash
correct & consistent value (one from "prefab mode").GlobalObjectIdHash
from "prefab mode" if last saved from "regular mode"GlobalObjectIdHash
from "regular mode" if last saved from "prefab mode"Reproduce Steps
I have written down detailed reproduction steps in Unity forum post: https://discussions.unity.com/t/multiplayer-play-mode-error-when-connecting-from-to-virtual-player-after-editing-networked-prefab/1564025
Short version:
Actual Outcome
Error:
Expected Outcome
Connection established successfully.
Screenshots
Player prefab inspector in "regular mode".
GlobalObjectIdHash: 3475022634
Player prefab inspector in "prefab mode".
GlobalObjectIdHash: 3871928766
Environment
Additional Context
-