|
1 | 1 | using System; |
2 | 2 | using System.Collections; |
3 | | -using System.Linq; |
| 3 | +using System.Collections.Generic; |
4 | 4 | using NUnit.Framework; |
5 | 5 | using Unity.Netcode.TestHelpers.Runtime; |
6 | 6 | using UnityEngine; |
@@ -41,9 +41,10 @@ public void RegisterCustomLoopInTheMiddle() |
41 | 41 | PlayerLoop.SetPlayerLoop(curPlayerLoop); |
42 | 42 |
|
43 | 43 | NetworkUpdateLoop.UnregisterLoopSystems(); |
44 | | - |
| 44 | + var subSystemArray = PlayerLoop.GetCurrentPlayerLoop().subSystemList[0].subSystemList; |
| 45 | + var lastType = subSystemArray[subSystemArray.Length - 1].type; |
45 | 46 | // our custom `PlayerLoopSystem` with the type of `NetworkUpdateLoopTests` should still exist |
46 | | - Assert.AreEqual(typeof(NetworkUpdateLoopTests), PlayerLoop.GetCurrentPlayerLoop().subSystemList[0].subSystemList.Last().type); |
| 47 | + Assert.AreEqual(typeof(NetworkUpdateLoopTests), lastType); |
47 | 48 | } |
48 | 49 | // replace the current PlayerLoop with the cached PlayerLoop after the test |
49 | 50 | PlayerLoop.SetPlayerLoop(cachedPlayerLoop); |
@@ -94,7 +95,14 @@ public void UpdateStageSystems() |
94 | 95 | for (int i = 0; i < currentPlayerLoop.subSystemList.Length; i++) |
95 | 96 | { |
96 | 97 | var playerLoopSystem = currentPlayerLoop.subSystemList[i]; |
97 | | - var subsystems = playerLoopSystem.subSystemList.ToList(); |
| 98 | + // New behaviour (6000.6.x) |
| 99 | + // Some PlayerLoopSystems can evidently now have no sub-system lists. |
| 100 | + if (playerLoopSystem.subSystemList == null) |
| 101 | + { |
| 102 | + // Ignore any PlayerLoopSystem with no sub-system lists. |
| 103 | + continue; |
| 104 | + } |
| 105 | + var subsystems = new List<PlayerLoopSystem>(playerLoopSystem.subSystemList); |
98 | 106 |
|
99 | 107 | if (playerLoopSystem.type == typeof(Initialization)) |
100 | 108 | { |
|
0 commit comments