7
7
8
8
namespace Unity . Netcode . RuntimeTests
9
9
{
10
- public struct FixedString32Struct : INetworkSerializable
11
- {
12
- public FixedString32Bytes FixedString ;
13
-
14
- public void NetworkSerialize < T > ( BufferSerializer < T > serializer ) where T : IReaderWriter
15
- {
16
- serializer . SerializeValue ( ref FixedString ) ;
17
- }
18
- }
19
-
20
10
public struct TestStruct : INetworkSerializable
21
11
{
22
12
public uint SomeInt ;
@@ -34,7 +24,7 @@ public class NetworkVariableTest : NetworkBehaviour
34
24
public readonly NetworkVariable < int > TheScalar = new NetworkVariable < int > ( ) ;
35
25
public readonly NetworkList < int > TheList = new NetworkList < int > ( ) ;
36
26
37
- public readonly NetworkVariable < FixedString32Struct > FixedStringStruct = new NetworkVariable < FixedString32Struct > ( ) ;
27
+ public readonly NetworkVariable < FixedString32Bytes > FixedString32 = new NetworkVariable < FixedString32Bytes > ( ) ;
38
28
39
29
private void ListChanged ( NetworkListEvent < int > e )
40
30
{
@@ -166,26 +156,23 @@ public void ClientWritePermissionTest([Values(true, false)] bool useHost)
166
156
}
167
157
168
158
[ UnityTest ]
169
- public IEnumerator FixedString32StructTest ( [ Values ( true , false ) ] bool useHost )
159
+ public IEnumerator FixedString32Test ( [ Values ( true , false ) ] bool useHost )
170
160
{
171
161
m_TestWithHost = useHost ;
172
162
yield return MultiInstanceHelpers . RunAndWaitForCondition (
173
163
( ) =>
174
164
{
175
- var tmp = m_Player1OnServer . FixedStringStruct . Value ;
176
- tmp . FixedString = k_FixedStringTestValue ;
177
- m_Player1OnServer . FixedStringStruct . Value = tmp ;
165
+ m_Player1OnServer . FixedString32 . Value = k_FixedStringTestValue ;
178
166
179
167
// we are writing to the private and public variables on player 1's object...
180
168
} ,
181
169
( ) =>
182
170
{
183
- var tmp = m_Player1OnClient1 . FixedStringStruct . Value ;
184
171
185
172
// ...and we should see the writes to the private var only on the server & the owner,
186
173
// but the public variable everywhere
187
174
return
188
- m_Player1OnClient1 . FixedStringStruct . Value . FixedString == k_FixedStringTestValue ;
175
+ m_Player1OnClient1 . FixedString32 . Value == k_FixedStringTestValue ;
189
176
}
190
177
) ;
191
178
}
0 commit comments