Skip to content

Commit 39ab294

Browse files
committed
fix: Improve hash collision error message to tell which PrefabHashGenerator is causing the collision.
1 parent 4634578 commit 39ab294

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

com.unity.multiplayer.mlapi/Runtime/Core/NetworkingManager.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,12 @@ private void OnValidate()
316316
{
317317
if (hashes.Contains(NetworkConfig.NetworkedPrefabs[i].Hash))
318318
{
319-
if (NetworkLog.CurrentLogLevel <= LogLevel.Normal) NetworkLog.LogError("PrefabHash collision! You have two prefabs with the same hash. This is not supported");
319+
if (NetworkLog.CurrentLogLevel <= LogLevel.Normal)
320+
{
321+
var prefabHashGenerator = NetworkConfig.NetworkedPrefabs[i].Prefab.GetComponent<NetworkedObject>().PrefabHashGenerator;
322+
NetworkLog.LogError($"PrefabHash collision! You have two prefabs with the same hash (PrefabHashGenerator = {prefabHashGenerator}). This is not supported");
323+
}
324+
320325
}
321326

322327
hashes.Add(NetworkConfig.NetworkedPrefabs[i].Hash);

0 commit comments

Comments
 (0)