Skip to content

Commit 34c7a4b

Browse files
committed
Fix DontDestroyOnLoadTest
1 parent d07687d commit 34c7a4b

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

com.unity.netcode.gameobjects/Tests/Runtime/TestHelpers/NetcodeIntegrationTest.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1804,6 +1804,9 @@ protected void DestroySceneNetworkObjects()
18041804
ghostAdapter.prefabReference = null;
18051805
Object.Destroy(prefabReference);
18061806
Object.Destroy(ghostAdapter);
1807+
// Only normally destroy hybrid-spawned objects.
1808+
Object.Destroy(networkObject.gameObject);
1809+
continue;
18071810
}
18081811

18091812
// Destroy the GameObject that holds the NetworkObject component

testproject/Assets/Tests/Manual/DontDestroyOnLoad/ObjectToNotDestroyBehaviour.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public uint CurrentPing
2323
/// <summary>
2424
/// When enabled, we move ourself to the DontDestroyOnLoad scene
2525
/// </summary>
26-
private void OnEnable()
26+
protected override void OnNetworkPreSpawn(ref NetworkManager networkManager)
2727
{
2828
DontDestroyOnLoad(this);
2929
}

0 commit comments

Comments
 (0)