Skip to content

Commit 60d38ff

Browse files
committed
Added prefab hash collision checks
1 parent 3735201 commit 60d38ff

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

MLAPI/MonoBehaviours/Core/NetworkingManager.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,19 @@ private void OnValidate()
223223
NetworkConfig.RegisteredScenes.Add(SceneManager.GetActiveScene().name);
224224
}
225225

226-
// TODO: Prefab hash collision check
226+
227+
// TODO: Show which two prefab generators that collide
228+
HashSet<ulong> hashes = new HashSet<ulong>();
229+
230+
for (int i = 0; i < NetworkConfig.NetworkedPrefabs.Count; i++)
231+
{
232+
if (hashes.Contains(NetworkConfig.NetworkedPrefabs[i].Hash))
233+
{
234+
if (LogHelper.CurrentLogLevel <= LogLevel.Normal) LogHelper.LogError("PrefabHash collision! You have two prefabs with the same hash. This is not supported");
235+
}
236+
237+
hashes.Add(NetworkConfig.NetworkedPrefabs[i].Hash);
238+
}
227239

228240
int playerPrefabCount = NetworkConfig.NetworkedPrefabs.Count(x => x.PlayerPrefab == true);
229241
if (playerPrefabCount == 0)

0 commit comments

Comments
 (0)