You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: networkmanager prefab validation and no scene management manual test (#1073)
* fix
This fixes issues with NetworkManager prefab override validation.
If you never assigned a Prefab but just wanted to override it would fail.
It never properly checked all potential cases, which this fixes.
* test
This validates the fixes as well as tests that disabling original/legacy scene management works.
* fix
Fixing issue with the wrong brackets around the wrong pair of initial checks for NetworkPrefab validation.
Updated the NetworkPrefabHandlerTests to account for all potential scenarios that should be handled without causing initialization to fail.
* refactor and style
fixed a typo in a comment in one of the newly added prefab registration checks
added a check for a valid hash override but invalid target prefab
* test and style
fixing comment and adding one of the potential invalid combinations (valid hash but invalid target prefab).
* fix
Fixing issue with the prefab not pointing to the right network prefab which made the client side not register the proper network prefab to override since disabling scene management requires that in-scene placed NetworkObjects be spawned by the server.
* Update com.unity.netcode.gameobjects/Runtime/Core/NetworkManager.cs
Co-authored-by: M. Fatih MAR <mfatihmar@gmail.com>
* Update com.unity.netcode.gameobjects/Tests/Runtime/NetworkPrefabHandlerTests.cs
Co-authored-by: M. Fatih MAR <mfatihmar@gmail.com>
* Update com.unity.netcode.gameobjects/Runtime/Core/NetworkManager.cs
Co-authored-by: M. Fatih MAR <mfatihmar@gmail.com>
* Update com.unity.netcode.gameobjects/Runtime/Core/NetworkManager.cs
Co-authored-by: M. Fatih MAR <mfatihmar@gmail.com>
* Update com.unity.netcode.gameobjects/Runtime/Core/NetworkManager.cs
Co-authored-by: M. Fatih MAR <mfatihmar@gmail.com>
Co-authored-by: M. Fatih MAR <mfatihmar@gmail.com>
$"is missing a {nameof(NetworkObject)} component (entry will be ignored).");
539
+
}
540
+
Debug.LogWarning($"{nameof(NetworkPrefab)} override entry (\"{NetworkConfig.NetworkPrefabs[i].SourcePrefabToOverride.name}\") will be removed and ignored.");
NetworkLog.LogWarning($"{nameof(NetworkPrefab)}{nameof(NetworkPrefab.OverridingTargetPrefab)} is null!");
556
+
}
557
+
removeEmptyPrefabs.Add(i);
558
+
switch(NetworkConfig.NetworkPrefabs[i].Override)
559
+
{
560
+
caseNetworkPrefabOverride.Hash:
561
+
{
562
+
Debug.LogWarning($"{nameof(NetworkPrefab)} override entry {NetworkConfig.NetworkPrefabs[i].SourceHashToOverride} will be removed and ignored.");
563
+
break;
564
+
}
565
+
caseNetworkPrefabOverride.Prefab:
566
+
{
567
+
Debug.LogWarning($"{nameof(NetworkPrefab)} override entry ({NetworkConfig.NetworkPrefabs[i].SourcePrefabToOverride.name}) will be removed and ignored.");
// This can happen if a user tries to make several GlobalObjectIdHash values point to the same target
609
+
Debug.LogError($"{nameof(NetworkPrefab)} (\"{networkObject.name}\") has a duplicate {nameof(NetworkObject.GlobalObjectIdHash)} target entry value of: {targetPrefabGlobalObjectIdHash}! Removing entry from list!");
610
+
removeEmptyPrefabs.Add(i);
611
+
}
525
612
}
526
613
}
527
614
else
528
615
{
529
616
// This should never happen, but in the case it somehow does log an error and remove the duplicate entry
530
-
Debug.LogError($"{nameof(NetworkPrefab)} (\"{NetworkConfig.NetworkPrefabs[i].Prefab.name}\") has a duplicate {nameof(NetworkObject.GlobalObjectIdHash)}{networkObject.GlobalObjectIdHash} entry! Removing entry from list!");
617
+
Debug.LogError($"{nameof(NetworkPrefab)} ({networkObject.name}) has a duplicate {nameof(NetworkObject.GlobalObjectIdHash)}source entry value of: {sourcePrefabGlobalObjectIdHash}! Removing entry from list!");
0 commit comments