Skip to content

Commit d30a1d1

Browse files
test
Minor test to validate the NetworkObject is no longer within the NetworkObject.NetworkObjectsToSynchronizeSceneChanges list upon destroying it prior to it being despawned.
1 parent d6c1627 commit d30a1d1

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

com.unity.netcode.gameobjects/Tests/Runtime/NetworkObject/NetworkObjectDestroyTests.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ internal class NetworkObjectDestroyTests : NetcodeIntegrationTest
2323

2424
public NetworkObjectDestroyTests(NetworkTopologyTypes networkTopologyType) : base(networkTopologyType) { }
2525

26+
protected override void OnCreatePlayerPrefab()
27+
{
28+
var playerNetworkObject = m_PlayerPrefab.GetComponent<NetworkObject>();
29+
playerNetworkObject.SceneMigrationSynchronization = true;
30+
base.OnCreatePlayerPrefab();
31+
}
32+
2633
/// <summary>
2734
/// Tests that a server can destroy a NetworkObject and that it gets despawned correctly.
2835
/// </summary>
@@ -133,6 +140,7 @@ public IEnumerator TestNetworkObjectClientDestroy([Values] ClientDestroyObject c
133140
yield return WaitForConditionOrTimeOut(HaveLogsBeenReceived);
134141
AssertOnTimeout($"Not all expected logs were received when destroying a {nameof(NetworkObject)} on the client side during an active session!");
135142
}
143+
Assert.IsFalse(NetworkObject.NetworkObjectsToSynchronizeSceneChanges.ContainsKey(m_ClientNetworkObjectId), $"Player object {m_ClientNetworkObjectId} still exists within {nameof(NetworkObject.NetworkObjectsToSynchronizeSceneChanges)}!");
136144
}
137145

138146
private bool HaveLogsBeenReceived()

0 commit comments

Comments
 (0)