Skip to content

Commit 528d5be

Browse files
LukeStampfli0xFA11
authored andcommitted
fix: Improve hash collision error message to tell which PrefabHashGenerator is causing the collision. (#490)
Co-authored-by: M. Fatih MAR <mfatihmar@gmail.com>
1 parent e09e501 commit 528d5be

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)