You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariableTests.cs
+41-1Lines changed: 41 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -48,6 +48,26 @@ public class StructHavingNetworkBehaviour : TemplateNetworkBehaviourType<TestStr
48
48
49
49
}
50
50
51
+
public struct StructUsedOnlyInNetworkList : IEquatable<StructUsedOnlyInNetworkList>, INetworkSerializeByMemcpy
52
+
{
53
+
public int Value;
54
+
55
+
public bool Equals(StructUsedOnlyInNetworkList other)
56
+
{
57
+
return Value == other.Value;
58
+
}
59
+
60
+
public override bool Equals(object obj)
61
+
{
62
+
return obj is StructUsedOnlyInNetworkList other && Equals(other);
63
+
}
64
+
65
+
public override int GetHashCode()
66
+
{
67
+
return Value;
68
+
}
69
+
}
70
+
51
71
[TestFixtureSource(nameof(TestDataSource))]
52
72
public class NetworkVariablePermissionTests : NetcodeIntegrationTest
53
73
{
@@ -433,6 +453,7 @@ public enum SomeEnum
433
453
public readonly NetworkVariable<int> TheScalar = new NetworkVariable<int>();
434
454
public readonly NetworkVariable<SomeEnum> TheEnum = new NetworkVariable<SomeEnum>();
435
455
public readonly NetworkList<int> TheList = new NetworkList<int>();
456
+
public readonly NetworkList<StructUsedOnlyInNetworkList> TheStructList = new NetworkList<StructUsedOnlyInNetworkList>();
436
457
public readonly NetworkList<FixedString128Bytes> TheLargeList = new NetworkList<FixedString128Bytes>();
437
458
438
459
public readonly NetworkVariable<FixedString32Bytes> FixedString32 = new NetworkVariable<FixedString32Bytes>();
@@ -449,7 +470,6 @@ public void Awake()
449
470
450
471
public readonly NetworkVariable<TestStruct> TheStruct = new NetworkVariable<TestStruct>();
451
472
public readonly NetworkVariable<TestClass> TheClass = new NetworkVariable<TestClass>();
452
-
public readonly NetworkList<TestStruct> TheListOfStructs = new NetworkList<TestStruct>();
453
473
454
474
public NetworkVariable<UnmanagedTemplateNetworkSerializableType<TestStruct>> TheTemplateStruct = new NetworkVariable<UnmanagedTemplateNetworkSerializableType<TestStruct>>();
455
475
public NetworkVariable<ManagedTemplateNetworkSerializableType<TestClass>> TheTemplateClass = new NetworkVariable<ManagedTemplateNetworkSerializableType<TestClass>>();
0 commit comments