Skip to content

Commit 1fe6a0f

Browse files
authored
chore: remove ClientNetworkVariable (#1167)
1 parent a38029a commit 1fe6a0f

File tree

3 files changed

+1
-128
lines changed

3 files changed

+1
-128
lines changed

com.unity.netcode.gameobjects/Runtime/NetworkVariable/ClientNetworkVariable.cs

Lines changed: 0 additions & 52 deletions
This file was deleted.

com.unity.netcode.gameobjects/Runtime/NetworkVariable/ClientNetworkVariable.cs.meta

Lines changed: 0 additions & 11 deletions
This file was deleted.

com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariableTests.cs

Lines changed: 1 addition & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using NUnit.Framework;
66
using Unity.Collections;
77

8-
98
namespace Unity.Netcode.RuntimeTests
109
{
1110
public struct FixedString32Struct : INetworkSerializable
@@ -43,13 +42,9 @@ public void NetworkSerialize(NetworkSerializer serializer)
4342
serializer.Serialize(ref SomeBool);
4443
}
4544
}
45+
4646
public class NetworkVariableTest : NetworkBehaviour
4747
{
48-
public readonly ClientNetworkVariable<int> ClientVar = new ClientNetworkVariable<int>();
49-
50-
public readonly ClientNetworkVariable<int> ClientVarPrivate =
51-
new ClientNetworkVariable<int>(NetworkVariableReadPermission.OwnerOnly);
52-
5348
public readonly NetworkVariable<int> TheScalar = new NetworkVariable<int>();
5449
public readonly NetworkList<int> TheList = new NetworkList<int>();
5550
public readonly NetworkSet<int> TheSet = new NetworkSet<int>();
@@ -232,38 +227,6 @@ public void ClientWritePermissionTest([Values(true, false)] bool useHost)
232227
Assert.Throws<InvalidOperationException>(() => m_Player1OnClient1.TheScalar.Value = k_TestVal1);
233228
}
234229

235-
[Test]
236-
public void ServerWritePermissionTest([Values(true, false)] bool useHost)
237-
{
238-
m_TestWithHost = useHost;
239-
240-
// server must not be allowed to write to a client auth variable
241-
Assert.Throws<InvalidOperationException>(() => m_Player1OnServer.ClientVar.Value = k_TestVal1);
242-
}
243-
244-
[UnityTest]
245-
public IEnumerator ClientTest([Values(true, false)] bool useHost)
246-
{
247-
m_TestWithHost = useHost;
248-
249-
yield return MultiInstanceHelpers.RunAndWaitForCondition(
250-
() =>
251-
{
252-
m_Player1OnClient1.ClientVar.Value = k_TestVal2;
253-
m_Player2OnClient2.ClientVar.Value = k_TestVal3;
254-
},
255-
() =>
256-
{
257-
// the client's values should win on the objects it owns
258-
return
259-
m_Player1OnServer.ClientVar.Value == k_TestVal2 &&
260-
m_Player2OnServer.ClientVar.Value == k_TestVal3 &&
261-
m_Player1OnClient1.ClientVar.Value == k_TestVal2 &&
262-
m_Player2OnClient2.ClientVar.Value == k_TestVal3;
263-
}
264-
);
265-
}
266-
267230
[UnityTest]
268231
public IEnumerator FixedString32StructTest([Values(true, false)] bool useHost)
269232
{
@@ -289,33 +252,6 @@ public IEnumerator FixedString32StructTest([Values(true, false)] bool useHost)
289252
);
290253
}
291254

292-
[UnityTest]
293-
public IEnumerator PrivateClientTest([Values(true, false)] bool useHost)
294-
{
295-
m_TestWithHost = useHost;
296-
297-
yield return MultiInstanceHelpers.RunAndWaitForCondition(
298-
() =>
299-
{
300-
// we are writing to the private and public variables on player 1's object...
301-
m_Player1OnClient1.ClientVarPrivate.Value = k_TestVal1;
302-
m_Player1OnClient1.ClientVar.Value = k_TestVal2;
303-
},
304-
() =>
305-
{
306-
// ...and we should see the writes to the private var only on the server & the owner,
307-
// but the public variable everywhere
308-
return
309-
m_Player1OnClient2.ClientVarPrivate.Value != k_TestVal1 &&
310-
m_Player1OnClient1.ClientVarPrivate.Value == k_TestVal1 &&
311-
m_Player1OnClient2.ClientVar.Value != k_TestVal2 &&
312-
m_Player1OnClient1.ClientVar.Value == k_TestVal2 &&
313-
m_Player1OnServer.ClientVarPrivate.Value == k_TestVal1 &&
314-
m_Player1OnServer.ClientVar.Value == k_TestVal2;
315-
}
316-
);
317-
}
318-
319255
[UnityTest]
320256
public IEnumerator NetworkListAdd([Values(true, false)] bool useHost)
321257
{

0 commit comments

Comments
 (0)