Skip to content

Commit 8470b76

Browse files
committed
Merge branch 'feat/add_networklist_asNativeArray' of https://github.com/Unity-Technologies/com.unity.netcode.gameobjects into feat/add_networklist_asNativeArray
2 parents 03bb611 + 956239b commit 8470b76

File tree

3 files changed

+747
-293
lines changed

3 files changed

+747
-293
lines changed

com.unity.netcode.gameobjects/Tests/Editor/Messaging/MessageCorruptionTests.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,13 @@ public unsafe void Send(ulong clientId, NetworkDelivery delivery, FastBufferWrit
9090
break;
9191
}
9292
case TypeOfCorruption.CorruptBytes:
93-
batchData.Seek(batchData.Length - 2);
94-
var currentByte = batchData.GetUnsafePtr()[0];
95-
batchData.WriteByteSafe((byte)(currentByte == 0 ? 1 : 0));
96-
MessageQueue.Add(batchData.ToArray());
93+
for (int i = 0; i < 4; i++)
94+
{
95+
var currentByte = batchData.GetUnsafePtr()[i];
96+
currentByte = (byte)((currentByte + 1) % 255);
97+
batchData.WriteByteSafe(currentByte);
98+
MessageQueue.Add(batchData.ToArray());
99+
}
97100
break;
98101
case TypeOfCorruption.Truncated:
99102
batchData.Truncate(batchData.Length - 1);

com.unity.netcode.gameobjects/Tests/Runtime/Transports/UnityTransportTests.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ public IEnumerator Cleanup()
5151

5252
// Need to destroy the GameObject (all assigned components will get destroyed too)
5353
UnityEngine.Object.DestroyImmediate(m_Server.gameObject);
54+
m_Server = null;
5455
}
5556

5657
if (m_Client1)
@@ -59,6 +60,7 @@ public IEnumerator Cleanup()
5960

6061
// Need to destroy the GameObject (all assigned components will get destroyed too)
6162
UnityEngine.Object.DestroyImmediate(m_Client1.gameObject);
63+
m_Client1 = null;
6264
}
6365

6466
if (m_Client2)
@@ -67,6 +69,7 @@ public IEnumerator Cleanup()
6769

6870
// Need to destroy the GameObject (all assigned components will get destroyed too)
6971
UnityEngine.Object.DestroyImmediate(m_Client2.gameObject);
72+
m_Client2 = null;
7073
}
7174
m_ServerEvents?.Clear();
7275
m_Client1Events?.Clear();
@@ -317,7 +320,7 @@ public IEnumerator DisconnectOnReliableSendQueueOverflow()
317320
m_Server.StartServer();
318321
m_Client1.StartClient();
319322

320-
yield return WaitForNetworkEvent(NetworkEvent.Connect, m_Client1Events);
323+
yield return WaitForNetworkEvent(NetworkEvent.Connect, m_Client1Events, 5.0f);
321324

322325
var serverClientId = m_Client1.ServerClientId;
323326

0 commit comments

Comments
 (0)