Skip to content

Commit 3f767f3

Browse files
committed
fix the tests
1 parent bb7c892 commit 3f767f3

2 files changed

Lines changed: 4 additions & 6 deletions

File tree

com.unity.netcode.gameobjects/Tests/Runtime/DocumentationCodeSamples/NetworkVariable/CustomNetworkVariable.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,8 @@ public IEnumerator CustomNetworkVariableCodeWorks()
231231
Assert.True(networkManager.SpawnManager.SpawnedObjects.TryGetValue(authorityObject.NetworkObjectId, out var localObject));
232232
var testBehaviour = localObject.GetComponent<TestMyCustomNetworkVariable>();
233233
Assert.NotNull(testBehaviour);
234-
Assert.AreEqual(authorityBehaviour.CustomNetworkVariable.SomeDataToSynchronize.Count, testBehaviour.CustomNetworkVariable.SomeDataToSynchronize.Count, $"[Client-{networkManager.LocalClientId}] Incorrect length found for {nameof(MyCustomNetworkVariable)}");
235-
Assert.AreEqual(authorityBehaviour.CustomGenericNetworkVariable.SomeDataToSynchronize, testBehaviour.CustomGenericNetworkVariable.SomeDataToSynchronize.Count, $"[Client-{networkManager.LocalClientId}] Incorrect length found for {nameof(MyCustomNetworkVariable)}");
234+
Assert.AreEqual(authorityBehaviour.CustomNetworkVariable.SomeDataToSynchronize, testBehaviour.CustomNetworkVariable.SomeDataToSynchronize, $"[Client-{networkManager.LocalClientId}] Incorrect length found for {nameof(MyCustomNetworkVariable)}");
235+
Assert.AreEqual(authorityBehaviour.CustomGenericNetworkVariable.SomeDataToSynchronize, testBehaviour.CustomGenericNetworkVariable.SomeDataToSynchronize, $"[Client-{networkManager.LocalClientId}] Incorrect length found for {nameof(MyCustomNetworkVariable)}");
236236
}
237237
}
238238
}

com.unity.netcode.gameobjects/Tests/Runtime/DocumentationCodeSamples/NetworkVariable/CustomSerializationDocsTests.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,13 @@ internal static void ReadValueSafe(this FastBufferReader reader, out CustomSeria
2727
internal class CustomSerializationDocsTests : NetcodeIntegrationTest
2828
{
2929
#region HealthExample
30-
3130
public struct Health
3231
{
3332
public uint MaxHealth;
3433
public int CurrentHealth;
3534

3635
// Register our custom serialization on load
37-
[RuntimeInitializeOnLoadMethod]
36+
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
3837
public static void RegisterHealthSerialization()
3938
{
4039
// You can reuse the FastBufferWriter and FastBufferReader extension methods we wrote above
@@ -53,7 +52,7 @@ public static void RegisterHealthSerialization()
5352
// This lets us save bandwidth when only one value has changed.
5453
// In the case of Health, we expect CurrentHealth to change much more often than MaxHealth
5554
// Implementing WriteDelta saves us bandwidth on not sending the MaxHealth every time CurrentHealth changes.
56-
internal enum ChangeType : byte
55+
private enum ChangeType : byte
5756
{
5857
MaxHealth,
5958
CurrentHealth,
@@ -110,7 +109,6 @@ public static void ReadDelta(FastBufferReader reader, ref Health value)
110109
}
111110
}
112111
}
113-
114112
#endregion
115113

116114
internal class TestHealthBehaviour : NetworkBehaviour

0 commit comments

Comments
 (0)