com.unity.netcode.gameobjects@2.0.0-exp.4

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

Additional documentation and release notes are available at [Multiplayer Documentation](https://docs-multiplayer.unity3d.com).

## [2.0.0-exp.4] - 2024-05-31

### Added

- Added `NetworkRigidbodyBase.AttachToFixedJoint` and `NetworkRigidbodyBase.DetachFromFixedJoint` to replace parenting for rigid bodies that have `NetworkRigidbodyBase.UseRigidBodyForMotion` enabled. (#2933)
- Added `NetworkBehaviour.OnNetworkPreSpawn` and `NetworkBehaviour.OnNetworkPostSpawn` methods that provide the ability to handle pre and post spawning actions during the `NetworkObject` spawn sequence. (#2912)
- Added a client-side only `NetworkBehaviour.OnNetworkSessionSynchronized` convenience method that is invoked on all `NetworkBehaviour`s after a newly joined client has finished synchronizing with the network session in progress. (#2912)
- Added `NetworkBehaviour.OnInSceneObjectsSpawned` convenience method that is invoked when all in-scene `NetworkObject`s have been spawned after a scene has been loaded or upon a host or server starting. (#2912)

### Fixed

- Fixed issue where non-authoritative rigid bodies with `NetworkRigidbodyBase.UseRigidBodyForMotion` enabled would constantly log errors about the renderTime being before `StartTimeConsumed`. (#2933)
- Fixed issue where in-scene placed NetworkObjects could be destroyed if a client disconnects early and/or before approval. (#2924)
- Fixed issue where a `NetworkObject` component's associated `NetworkBehaviour` components would not be detected if scene loading is disabled in the editor and the currently loaded scene has in-scene placed `NetworkObject`s. (#2912)
- Fixed issue where an in-scene placed `NetworkObject` with `NetworkTransform` that is also parented under a `GameObject` would not properly synchronize when the parent `GameObject` had a world space position other than 0,0,0. (#2898)

### Changed

- Change all the access modifiers of test class from Public to Internal (#2930)
- Changed messages are now sorted by enum values as opposed to ordinally sorting the messages by their type name. (#2929)
- Changed `NetworkClient.SessionModeTypes` to `NetworkClient.NetworkTopologyTypes`. (#2875)
- Changed `NetworkClient.SessionModeType` to `NetworkClient.NetworkTopologyType`. (#2875)
- Changed `NetworkConfig.SessionMode` to `NeworkConfig.NetworkTopology`. (#2875)
This commit is contained in:
Unity Technologies
2024-05-31 00:00:00 +00:00
parent 143a6cbd34
commit 63c7e4c78a
177 changed files with 1792 additions and 820 deletions

View File

@@ -2,7 +2,7 @@ using NUnit.Framework;
namespace Unity.Netcode.EditorTests
{
public class ArithmeticTests
internal class ArithmeticTests
{
[Test]
public void TestCeil()

View File

@@ -8,7 +8,7 @@ using UnityEngine;
namespace Unity.Netcode.EditorTests
{
public class BuildTests
internal class BuildTests
{
public const string DefaultBuildScenePath = "Tests/Editor/Build/BuildTestScene.unity";

View File

@@ -3,7 +3,7 @@ using Unity.Collections;
namespace Unity.Netcode.EditorTests
{
public class DisconnectMessageTests
internal class DisconnectMessageTests
{
[Test]
public void EmptyDisconnectReason()

View File

@@ -3,7 +3,7 @@ using NUnit.Framework;
namespace Unity.Netcode.EditorTests
{
public class InterpolatorTests
internal class InterpolatorTests
{
private const float k_Precision = 0.00000001f;
private const int k_MockTickRate = 1;

View File

@@ -3,7 +3,7 @@ using NUnit.Framework;
namespace Unity.Netcode.EditorTests
{
public class DisconnectOnSendTests
internal class DisconnectOnSendTests
{
private struct TestMessage : INetworkMessage, INetworkSerializeByMemcpy
{

View File

@@ -10,7 +10,7 @@ using UnityEngine.TestTools;
namespace Unity.Netcode.EditorTests
{
public class MessageCorruptionTests
internal class MessageCorruptionTests
{
private struct TestMessage : INetworkMessage, INetworkSerializeByMemcpy

View File

@@ -7,7 +7,7 @@ using Unity.Collections.LowLevel.Unsafe;
namespace Unity.Netcode.EditorTests
{
public class MessageReceivingTests
internal class MessageReceivingTests
{
private struct TestMessage : INetworkMessage, INetworkSerializeByMemcpy
{

View File

@@ -3,7 +3,7 @@ using NUnit.Framework;
namespace Unity.Netcode.EditorTests
{
public class MessageRegistrationTests
internal class MessageRegistrationTests
{
private struct TestMessageOne : INetworkMessage, INetworkSerializeByMemcpy
{
@@ -191,77 +191,5 @@ namespace Unity.Netcode.EditorTests
Assert.AreEqual(handlerFour, systemThree.MessageHandlers[systemThree.GetMessageType(typeof(TestMessageFour))]);
}
}
internal class AAAEarlyLexicographicNetworkMessage : INetworkMessage
{
public void Serialize(FastBufferWriter writer, int targetVersion)
{
}
public bool Deserialize(FastBufferReader reader, ref NetworkContext context, int receivedMessageVersion)
{
return true;
}
public void Handle(ref NetworkContext context)
{
}
public int Version => 0;
}
#pragma warning disable IDE1006
internal class zzzLateLexicographicNetworkMessage : AAAEarlyLexicographicNetworkMessage
{
}
#pragma warning restore IDE1006
internal class OrderingMessageProvider : INetworkMessageProvider
{
public List<NetworkMessageManager.MessageWithHandler> GetMessages()
{
var listMessages = new List<NetworkMessageManager.MessageWithHandler>();
var messageWithHandler = new NetworkMessageManager.MessageWithHandler
{
MessageType = typeof(zzzLateLexicographicNetworkMessage),
GetVersion = NetworkMessageManager.CreateMessageAndGetVersion<zzzLateLexicographicNetworkMessage>
};
listMessages.Add(messageWithHandler);
messageWithHandler.MessageType = typeof(ConnectionRequestMessage);
messageWithHandler.GetVersion = NetworkMessageManager.CreateMessageAndGetVersion<ConnectionRequestMessage>;
listMessages.Add(messageWithHandler);
messageWithHandler.MessageType = typeof(ConnectionApprovedMessage);
messageWithHandler.GetVersion = NetworkMessageManager.CreateMessageAndGetVersion<ConnectionApprovedMessage>;
listMessages.Add(messageWithHandler);
messageWithHandler.MessageType = typeof(AAAEarlyLexicographicNetworkMessage);
messageWithHandler.GetVersion = NetworkMessageManager.CreateMessageAndGetVersion<AAAEarlyLexicographicNetworkMessage>;
listMessages.Add(messageWithHandler);
return listMessages;
}
}
[Test]
public void MessagesGetPrioritizedCorrectly()
{
var sender = new NopMessageSender();
var provider = new OrderingMessageProvider();
using var messageManager = new NetworkMessageManager(sender, null, provider);
// the 2 priority messages should appear first, in lexicographic order
Assert.AreEqual(messageManager.MessageTypes[0], typeof(ConnectionApprovedMessage));
Assert.AreEqual(messageManager.MessageTypes[1], typeof(ConnectionRequestMessage));
// the other should follow after
Assert.AreEqual(messageManager.MessageTypes[2], typeof(AAAEarlyLexicographicNetworkMessage));
Assert.AreEqual(messageManager.MessageTypes[3], typeof(zzzLateLexicographicNetworkMessage));
// there should not be any extras
Assert.AreEqual(messageManager.MessageHandlerCount, 4);
}
}
}

View File

@@ -10,7 +10,7 @@ using Random = System.Random;
namespace Unity.Netcode.EditorTests
{
public class MessageSendingTests
internal class MessageSendingTests
{
private struct TestMessage : INetworkMessage, INetworkSerializeByMemcpy
{

View File

@@ -5,7 +5,7 @@ using NUnit.Framework.Internal;
namespace Unity.Netcode.EditorTests
{
public class MessageVersioningTests
internal class MessageVersioningTests
{
public static int SentVersion;
public static int ReceivedVersion;

View File

@@ -8,7 +8,7 @@ using Unity.Multiplayer.Tools.NetStats;
namespace Unity.Netcode.EditorTests.Metrics
{
public class NetworkMetricsRegistrationTests
internal class NetworkMetricsRegistrationTests
{
private static Type[] s_MetricTypes = AppDomain.CurrentDomain.GetAssemblies()
.SelectMany(x => x.GetTypes())

View File

@@ -4,7 +4,7 @@ using Object = UnityEngine.Object;
namespace Unity.Netcode.EditorTests
{
public class NetworkBehaviourTests
internal class NetworkBehaviourTests
{
[Test]
public void HasNetworkObjectTest()
@@ -66,12 +66,12 @@ namespace Unity.Netcode.EditorTests
// Note: in order to repro https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/issues/1078
// this child class must be defined before its parent to assure it is processed first by ILPP
public class DerivedNetworkBehaviour : EmptyNetworkBehaviour
internal class DerivedNetworkBehaviour : EmptyNetworkBehaviour
{
}
public class EmptyNetworkBehaviour : NetworkBehaviour
internal class EmptyNetworkBehaviour : NetworkBehaviour
{
}

View File

@@ -9,8 +9,20 @@ using UnityEngine.TestTools;
namespace Unity.Netcode.EditorTests
{
public class NetworkManagerConfigurationTests
internal class NetworkManagerConfigurationTests
{
[SetUp]
public void OnSetup()
{
ILPPMessageProvider.IntegrationTestNoMessages = true;
}
[TearDown]
public void OnTearDown()
{
ILPPMessageProvider.IntegrationTestNoMessages = false;
}
/// <summary>
/// Does a simple check to make sure the nested network manager will
/// notify the user when in the editor. This is just a unit test to

View File

@@ -6,7 +6,7 @@ using UnityEngine.TestTools;
namespace Unity.Netcode.EditorTests
{
public class NetworkObjectTests
internal class NetworkObjectTests
{
[Test]
public void NetworkManagerOverrideTest()
@@ -146,12 +146,12 @@ namespace Unity.Netcode.EditorTests
public int NetworkBehaviourIndex;
}
public class EmptyNetworkBehaviour : NetworkBehaviour
internal class EmptyNetworkBehaviour : NetworkBehaviour
{
}
public class EmptyMonoBehaviour : MonoBehaviour
internal class EmptyMonoBehaviour : MonoBehaviour
{
}

View File

@@ -5,7 +5,7 @@ using UnityEngine;
namespace Unity.Netcode.EditorTests
{
public class NetworkPrefabProcessorTests
internal class NetworkPrefabProcessorTests
{
private NetcodeForGameObjectsProjectSettings m_Settings;
private bool m_EditorDefaultPrefabSetting;

View File

@@ -3,9 +3,9 @@ using UnityEngine;
namespace Unity.Netcode.EditorTests.NetworkVar
{
public class NetworkVarTests
internal class NetworkVarTests
{
public class NetworkVarComponent : NetworkBehaviour
internal class NetworkVarComponent : NetworkBehaviour
{
public NetworkVariable<int> NetworkVariable = new NetworkVariable<int>();
}

View File

@@ -6,7 +6,7 @@ using Random = System.Random;
namespace Unity.Netcode.EditorTests
{
public abstract class BaseFastBufferReaderWriterTest
internal abstract class BaseFastBufferReaderWriterTest
{
protected enum ByteEnum : byte
{

View File

@@ -2,7 +2,7 @@ using NUnit.Framework;
namespace Unity.Netcode.EditorTests
{
public class BitCounterTests
internal class BitCounterTests
{
[Test]
public void WhenCountingUsedBitsIn64BitValue_ResultMatchesHighBitSetPlusOne([Range(0, 63)] int highBit)

View File

@@ -4,7 +4,7 @@ using Unity.Collections;
namespace Unity.Netcode.EditorTests
{
public class BitReaderTests
internal class BitReaderTests
{
[Test]
public void TestReadingOneBit()

View File

@@ -4,7 +4,7 @@ using Unity.Collections;
namespace Unity.Netcode.EditorTests
{
public class BitWriterTests
internal class BitWriterTests
{
[Test]
public unsafe void TestWritingOneBit()

View File

@@ -5,7 +5,7 @@ using Random = System.Random;
namespace Unity.Netcode.EditorTests
{
public class BufferSerializerTests
internal class BufferSerializerTests
{
[Test]
public void TestIsReaderIsWriter()

View File

@@ -8,7 +8,7 @@ using Random = System.Random;
namespace Unity.Netcode.EditorTests
{
public class BytePackerTests
internal class BytePackerTests
{
private enum ByteEnum : byte
{

View File

@@ -7,7 +7,7 @@ using Random = System.Random;
namespace Unity.Netcode.EditorTests
{
public class FastBufferReaderTests : BaseFastBufferReaderWriterTest
internal class FastBufferReaderTests : BaseFastBufferReaderWriterTest
{
private void WriteCheckBytes(FastBufferWriter writer, int writeSize, string failMessage = "")
{

View File

@@ -8,7 +8,7 @@ using Random = System.Random;
namespace Unity.Netcode.EditorTests
{
public class FastBufferWriterTests : BaseFastBufferReaderWriterTest
internal class FastBufferWriterTests : BaseFastBufferReaderWriterTest
{
private void WriteCheckBytes(FastBufferWriter writer, int writeSize, string failMessage = "")
{

View File

@@ -3,7 +3,7 @@ using Unity.Collections;
namespace Unity.Netcode.EditorTests
{
public class UserBitReaderAndBitWriterTests_NCCBUG175
internal class UserBitReaderAndBitWriterTests_NCCBUG175
{
[Test]

View File

@@ -7,7 +7,7 @@ namespace Unity.Netcode.EditorTests
/// <summary>
/// Tests for running a <see cref="NetworkTimeSystem"/> as a client.
/// </summary>
public class ClientNetworkTimeSystemTests
internal class ClientNetworkTimeSystemTests
{
private const double k_AcceptableRttOffset = 0.03d; // 30ms offset is fine

View File

@@ -7,7 +7,7 @@ using Random = System.Random;
namespace Unity.Netcode.EditorTests
{
public class NetworkTimeTests
internal class NetworkTimeTests
{
[Test]
[TestCase(0d, 0u)]

View File

@@ -3,7 +3,7 @@ using UnityEngine;
namespace Unity.Netcode.EditorTests
{
public class ServerNetworkTimeSystemTests
internal class ServerNetworkTimeSystemTests
{
/// <summary>

View File

@@ -7,7 +7,7 @@ namespace Unity.Netcode.EditorTests
/// <summary>
/// Helper functions for timing related tests. Allows to get a set of time steps and simulate time advancing without the need of a full playmode test.
/// </summary>
public static class TimingTestHelper
internal static class TimingTestHelper
{
public static List<float> GetRandomTimeSteps(float totalDuration, float min, float max, int seed)
{

View File

@@ -8,7 +8,7 @@ using Unity.Networking.Transport;
namespace Unity.Netcode.EditorTests
{
public class BatchedReceiveQueueTests
internal class BatchedReceiveQueueTests
{
[Test]
public void BatchedReceiveQueue_EmptyReader()

View File

@@ -8,7 +8,7 @@ using Unity.Networking.Transport;
namespace Unity.Netcode.EditorTests
{
public class BatchedSendQueueTests
internal class BatchedSendQueueTests
{
private const int k_TestQueueCapacity = 16 * 1024;
private const int k_TestMessageSize = 1020;

View File

@@ -7,7 +7,7 @@ using UnityEngine.TestTools;
namespace Unity.Netcode.EditorTests
{
public class UNetTransportTests
internal class UNetTransportTests
{
[Test]
public void StartServerReturnsFalseOnFailure()

View File

@@ -5,8 +5,20 @@ using UnityEngine.TestTools;
namespace Unity.Netcode.EditorTests
{
public class UnityTransportTests
internal class UnityTransportTests
{
[SetUp]
public void OnSetup()
{
ILPPMessageProvider.IntegrationTestNoMessages = true;
}
[TearDown]
public void OnTearDown()
{
ILPPMessageProvider.IntegrationTestNoMessages = false;
}
// Check that starting an IPv4 server succeeds.
[Test]
public void UnityTransport_BasicInitServer_IPv4()

View File

@@ -2,7 +2,7 @@ using NUnit.Framework;
namespace Unity.Netcode.EditorTests
{
public class XXHashTests
internal class XXHashTests
{
[Test]
public void TestXXHash32Short()

View File

@@ -7,9 +7,9 @@ using Object = UnityEngine.Object;
namespace Unity.Netcode.RuntimeTests
{
public class AddNetworkPrefabTest : NetcodeIntegrationTest
internal class AddNetworkPrefabTest : NetcodeIntegrationTest
{
public class EmptyComponent : NetworkBehaviour
internal class EmptyComponent : NetworkBehaviour
{
}

View File

@@ -7,7 +7,7 @@ using UnityEngine.TestTools;
namespace Unity.Netcode.RuntimeTests
{
public class ClientApprovalDenied : NetcodeIntegrationTest
internal class ClientApprovalDenied : NetcodeIntegrationTest
{
protected override int NumberOfClients => 2;
private bool m_ApproveConnection = true;

View File

@@ -7,7 +7,7 @@ using UnityEngine.TestTools;
namespace Unity.Netcode.RuntimeTests
{
public class ClientOnlyConnectionTests
internal class ClientOnlyConnectionTests
{
private NetworkManager m_ClientNetworkManager;
private GameObject m_NetworkManagerGameObject;

View File

@@ -9,7 +9,7 @@ namespace Unity.Netcode.RuntimeTests
/// - Sending and Receiving a continually growing buffer up to (MaximumBufferSize)
/// - Default maximum buffer size is 1MB
/// </summary>
public class BufferDataValidationComponent : NetworkBehaviour
internal class BufferDataValidationComponent : NetworkBehaviour
{
/// <summary>
/// Allows the external RPCQueueTest to begin testing or stop it

View File

@@ -6,7 +6,7 @@ using UnityEngine;
namespace Unity.Netcode.RuntimeTests
{
public class EmbeddedManagedNetworkSerializableType : INetworkSerializable
internal class EmbeddedManagedNetworkSerializableType : INetworkSerializable
{
public int Int;
public void NetworkSerialize<T>(BufferSerializer<T> serializer) where T : IReaderWriter
@@ -14,7 +14,7 @@ namespace Unity.Netcode.RuntimeTests
serializer.SerializeValue(ref Int);
}
}
public class ManagedNetworkSerializableType : INetworkSerializable, IEquatable<ManagedNetworkSerializableType>
internal class ManagedNetworkSerializableType : INetworkSerializable, IEquatable<ManagedNetworkSerializableType>
{
public string Str = "";
public int[] Ints = Array.Empty<int>();
@@ -104,7 +104,7 @@ namespace Unity.Netcode.RuntimeTests
return 0;
}
}
public struct UnmanagedNetworkSerializableType : INetworkSerializable, IEquatable<UnmanagedNetworkSerializableType>
internal struct UnmanagedNetworkSerializableType : INetworkSerializable, IEquatable<UnmanagedNetworkSerializableType>
{
public FixedString32Bytes Str;
public int Int;
@@ -143,7 +143,7 @@ namespace Unity.Netcode.RuntimeTests
}
public struct UnmanagedTemplateNetworkSerializableType<T> : INetworkSerializable where T : unmanaged, INetworkSerializable
internal struct UnmanagedTemplateNetworkSerializableType<T> : INetworkSerializable where T : unmanaged, INetworkSerializable
{
public T Value;
@@ -153,7 +153,7 @@ namespace Unity.Netcode.RuntimeTests
}
}
public struct ManagedTemplateNetworkSerializableType<T> : INetworkSerializable where T : class, INetworkSerializable, new()
internal struct ManagedTemplateNetworkSerializableType<T> : INetworkSerializable where T : class, INetworkSerializable, new()
{
public T Value;

View File

@@ -1,6 +1,6 @@
namespace Unity.Netcode.RuntimeTests
{
public class NetworkVisibilityComponent : NetworkBehaviour
internal class NetworkVisibilityComponent : NetworkBehaviour
{
public void Hide()
{

View File

@@ -8,7 +8,7 @@ using UnityEngine.TestTools;
namespace Unity.Netcode.RuntimeTests
{
public class ConnectionApprovalTests
internal class ConnectionApprovalTests
{
private Guid m_ValidationToken;
private bool m_IsValidated;

View File

@@ -9,7 +9,7 @@ namespace Unity.Netcode.RuntimeTests
{
[TestFixture(ApprovalTimedOutTypes.ServerDoesNotRespond)]
[TestFixture(ApprovalTimedOutTypes.ClientDoesNotRequest)]
public class ConnectionApprovalTimeoutTests : NetcodeIntegrationTest
internal class ConnectionApprovalTimeoutTests : NetcodeIntegrationTest
{
protected override int NumberOfClients => 1;

View File

@@ -116,7 +116,7 @@ namespace Unity.Netcode.RuntimeTests
}
}
public class DeferredMessageTestRpcComponent : NetworkBehaviour
internal class DeferredMessageTestRpcComponent : NetworkBehaviour
{
public bool ClientRpcCalled;
@@ -137,7 +137,7 @@ namespace Unity.Netcode.RuntimeTests
}
}
public class DeferredMessageTestNetworkVariableComponent : NetworkBehaviour
internal class DeferredMessageTestNetworkVariableComponent : NetworkBehaviour
{
public static readonly List<ulong> ClientInstances = new List<ulong>();
@@ -158,7 +158,7 @@ namespace Unity.Netcode.RuntimeTests
}
}
public class DeferredMessageTestRpcAndNetworkVariableComponent : NetworkBehaviour
internal class DeferredMessageTestRpcAndNetworkVariableComponent : NetworkBehaviour
{
public static readonly List<ulong> ClientInstances = new List<ulong>();
public bool ClientRpcCalled;
@@ -185,7 +185,7 @@ namespace Unity.Netcode.RuntimeTests
}
}
public class DeferredMessagingTest : NetcodeIntegrationTest
internal class DeferredMessagingTest : NetcodeIntegrationTest
{
protected override int NumberOfClients => 0;

View File

@@ -21,7 +21,7 @@ namespace Unity.Netcode.RuntimeTests
/// </summary>
[TestFixture(OwnerPersistence.DestroyWithOwner)]
[TestFixture(OwnerPersistence.DontDestroyWithOwner)]
public class DisconnectTests : NetcodeIntegrationTest
internal class DisconnectTests : NetcodeIntegrationTest
{
public enum OwnerPersistence
{

View File

@@ -9,7 +9,7 @@ using UnityEngine.TestTools;
namespace Unity.Netcode.RuntimeTests
{
public class DeferredDespawningTests : IntegrationTestWithApproximation
internal class DeferredDespawningTests : IntegrationTestWithApproximation
{
private const int k_DaisyChainedCount = 5;
protected override int NumberOfClients => 2;
@@ -85,7 +85,7 @@ namespace Unity.Netcode.RuntimeTests
/// prefab driven by the authority. This repeats for the number specified in the integration
/// test.
/// </summary>
public class DeferredDespawnDaisyChained : NetworkBehaviour
internal class DeferredDespawnDaisyChained : NetworkBehaviour
{
public static bool EnableVerbose;
public static Action<ulong> ReachedLastChainInstance;

View File

@@ -17,7 +17,7 @@ namespace Unity.Netcode.RuntimeTests
/// Validates that distributable NetworkObjects are distributed upon
/// a client connecting or disconnecting.
/// </summary>
public class DistributeObjectsTests : IntegrationTestWithApproximation
internal class DistributeObjectsTests : IntegrationTestWithApproximation
{
private GameObject m_DistributeObject;
@@ -352,7 +352,7 @@ namespace Unity.Netcode.RuntimeTests
/// This keeps track of each clients perspective of which NetworkObjects are owned by which client.
/// It is used to validate that all clients are in synch with ownership updates.
/// </summary>
public class DistributeObjectsTestHelper : NetworkBehaviour
internal class DistributeObjectsTestHelper : NetworkBehaviour
{
/// <summary>
/// [Client Context][Client Owners][NetworkObjectId][NetworkObject]
@@ -426,7 +426,7 @@ namespace Unity.Netcode.RuntimeTests
/// This is used to validate that upon distributed ownership changes NetworkTransform sycnhronization
/// still works properly.
/// </summary>
public class DistributeTestTransform : NetworkTransform
internal class DistributeTestTransform : NetworkTransform
{
private float m_DeltaVarPosition = 0.15f;
private float m_DeltaVarQauternion = 0.015f;
@@ -475,10 +475,8 @@ namespace Unity.Netcode.RuntimeTests
m_ReachedTarget = false;
}
protected override void Update()
public override void OnUpdate()
{
base.Update();
if (CanCommitToTransform)
{
if (!m_ReachedTarget)

View File

@@ -16,15 +16,15 @@ using UnityEngine.TestTools;
namespace Unity.Netcode.RuntimeTests
{
public class DistributedAuthorityCodecTests : NetcodeIntegrationTest
internal class DistributedAuthorityCodecTests : NetcodeIntegrationTest
{
protected override int NumberOfClients => 1;
// Use the CMB Service for all tests
protected override bool UseCMBService() => true;
// Set the session mode to distributed authority for all tests
protected override SessionModeTypes OnGetSessionmode() => SessionModeTypes.DistributedAuthority;
// Set the network topology to distributed authority for all tests
protected override NetworkTopologyTypes OnGetNetworkTopologyType() => NetworkTopologyTypes.DistributedAuthority;
private CodecTestHooks m_ClientCodecHook;
private NetworkManager Client => m_ClientNetworkManagers[0];
@@ -35,7 +35,7 @@ namespace Unity.Netcode.RuntimeTests
private GameObject m_SpawnObject;
public class TestNetworkComponent : NetworkBehaviour
internal class TestNetworkComponent : NetworkBehaviour
{
public NetworkList<int> MyNetworkList = new NetworkList<int>(new List<int> { 1, 2, 3 });

View File

@@ -14,7 +14,7 @@ namespace Unity.Netcode.RuntimeTests
[TestFixture(HostOrServer.Host)]
[TestFixture(HostOrServer.Server)]
[TestFixture(HostOrServer.DAHost)]
public class NetworkClientAndPlayerObjectTests : NetcodeIntegrationTest
internal class NetworkClientAndPlayerObjectTests : NetcodeIntegrationTest
{
private const int k_PlayerPrefabCount = 6;
protected override int NumberOfClients => 2;
@@ -168,7 +168,7 @@ namespace Unity.Netcode.RuntimeTests
[UnityTest]
public IEnumerator ValidateNetworkClients()
{
// Validate the initial clients created
// Validate the initial clients created
yield return WaitForConditionOrTimeOut(AllNetworkClientsValidated);
AssertOnTimeout($"[Start] Not all NetworkClients were valid!\n{m_ErrorLogLevel1}");
@@ -190,7 +190,7 @@ namespace Unity.Netcode.RuntimeTests
}
/// <summary>
/// Verify that all NetworkClients are pointing to the correct player object, even if
/// Verify that all NetworkClients are pointing to the correct player object, even if
/// the player object is changed.
/// </summary>
private bool ValidatePlayerObjectOnClients(NetworkManager clientToValidate)

View File

@@ -9,7 +9,7 @@ using UnityEngine.TestTools;
namespace Unity.Netcode.RuntimeTests
{
public class OwnershipPermissionsTests : IntegrationTestWithApproximation
internal class OwnershipPermissionsTests : IntegrationTestWithApproximation
{
private GameObject m_PermissionsObject;
@@ -332,7 +332,7 @@ namespace Unity.Netcode.RuntimeTests
AssertOnTimeout($"[Targeted Owner] Client-{daHostInstance.NetworkManager.LocalClientId} did not get the right request reponse: {daHostInstanceHelper.OwnershipRequestResponseStatus} Expecting: {NetworkObject.OwnershipRequestResponseStatus.Approved}!");
}
public class OwnershipPermissionsTestHelper : NetworkBehaviour
internal class OwnershipPermissionsTestHelper : NetworkBehaviour
{
public static NetworkObject CurrentOwnedInstance;

View File

@@ -7,11 +7,11 @@ using UnityEngine.TestTools;
namespace Unity.Netcode.RuntimeTests
{
public class HiddenVariableTest : NetworkBehaviour
internal class HiddenVariableTest : NetworkBehaviour
{
}
public class HiddenVariableObject : NetworkBehaviour
internal class HiddenVariableObject : NetworkBehaviour
{
public static List<NetworkObject> ClientInstancesSpawned = new List<NetworkObject>();
@@ -69,7 +69,7 @@ namespace Unity.Netcode.RuntimeTests
}
}
public class HiddenVariableTests : NetcodeIntegrationTest
internal class HiddenVariableTests : NetcodeIntegrationTest
{
protected override int NumberOfClients => 4;

View File

@@ -7,7 +7,7 @@ using UnityEngine.TestTools;
namespace Unity.Netcode.RuntimeTests
{
public class IntegrationTestUpdated : NetcodeIntegrationTest
internal class IntegrationTestUpdated : NetcodeIntegrationTest
{
private GameObject m_MyNetworkPrefab;
protected override int NumberOfClients => 1;
@@ -45,7 +45,7 @@ namespace Unity.Netcode.RuntimeTests
[TestFixture(HostOrServer.Host)]
[TestFixture(HostOrServer.Server)]
public class IntegrationTestExtended : NetcodeIntegrationTest
internal class IntegrationTestExtended : NetcodeIntegrationTest
{
private GameObject m_MyNetworkPrefab;
protected override int NumberOfClients => 1;
@@ -84,11 +84,11 @@ namespace Unity.Netcode.RuntimeTests
}
}
public class ExampleTestComponent : NetworkBehaviour
internal class ExampleTestComponent : NetworkBehaviour
{
}
public class IntegrationTestPlayers : NetcodeIntegrationTest
internal class IntegrationTestPlayers : NetcodeIntegrationTest
{
protected override int NumberOfClients => 5;
@@ -126,13 +126,13 @@ namespace Unity.Netcode.RuntimeTests
}
}
public class SpawnTest : NetworkBehaviour
internal class SpawnTest : NetworkBehaviour
{
public static int TotalSpawned;
public override void OnNetworkSpawn() { TotalSpawned++; }
public override void OnNetworkDespawn() { TotalSpawned--; }
}
public class IntegrationTestSpawning : NetcodeIntegrationTest
internal class IntegrationTestSpawning : NetcodeIntegrationTest
{
protected override int NumberOfClients => 2;
private GameObject m_NetworkPrefabToSpawn;

View File

@@ -12,7 +12,7 @@ using Debug = UnityEngine.Debug;
namespace Unity.Netcode.RuntimeTests
{
public class InvalidConnectionEventsTest : NetcodeIntegrationTest
internal class InvalidConnectionEventsTest : NetcodeIntegrationTest
{
protected override int NumberOfClients => 1;

View File

@@ -6,12 +6,12 @@ using UnityEngine.TestTools;
namespace Unity.Netcode.RuntimeTests
{
public class NetworkListChangedTestComponent : NetworkBehaviour
internal class NetworkListChangedTestComponent : NetworkBehaviour
{
}
public class ListChangedObject : NetworkBehaviour
internal class ListChangedObject : NetworkBehaviour
{
public int ExpectedPreviousValue = 0;
public int ExpectedValue = 0;
@@ -46,9 +46,9 @@ namespace Unity.Netcode.RuntimeTests
}
}
[TestFixture(SessionModeTypes.DistributedAuthority)]
[TestFixture(SessionModeTypes.ClientServer)]
public class NetworkListChangedTests : NetcodeIntegrationTest
[TestFixture(NetworkTopologyTypes.DistributedAuthority)]
[TestFixture(NetworkTopologyTypes.ClientServer)]
internal class NetworkListChangedTests : NetcodeIntegrationTest
{
protected override int NumberOfClients => 2;
@@ -57,7 +57,7 @@ namespace Unity.Netcode.RuntimeTests
private NetworkObject m_NetSpawnedObject1;
public NetworkListChangedTests(SessionModeTypes sessionModeType) : base(sessionModeType) { }
public NetworkListChangedTests(NetworkTopologyTypes networkTopologyType) : base(networkTopologyType) { }
protected override void OnServerAndClientsCreated()
{

View File

@@ -8,12 +8,12 @@ using UnityEngine.TestTools;
namespace Unity.Netcode.RuntimeTests
{
public class DisconnectReasonObject : NetworkBehaviour
internal class DisconnectReasonObject : NetworkBehaviour
{
}
public class DisconnectReasonTests : NetcodeIntegrationTest
internal class DisconnectReasonTests : NetcodeIntegrationTest
{
protected override int NumberOfClients => 2;

View File

@@ -8,7 +8,7 @@ using UnityEngine.TestTools;
namespace Unity.Netcode.RuntimeTests
{
public class NamedMessageTests : NetcodeIntegrationTest
internal class NamedMessageTests : NetcodeIntegrationTest
{
protected override int NumberOfClients => 2;

View File

@@ -8,7 +8,7 @@ using UnityEngine.TestTools;
namespace Unity.Netcode.RuntimeTests
{
public class UnnamedMessageTests : NetcodeIntegrationTest
internal class UnnamedMessageTests : NetcodeIntegrationTest
{
protected override int NumberOfClients => 2;

View File

@@ -14,7 +14,7 @@ namespace Unity.Netcode.RuntimeTests.Metrics
[TestFixture(ClientCount.TwoClients, HostOrServer.Host)]
[TestFixture(ClientCount.OneClient, HostOrServer.Server)]
[TestFixture(ClientCount.TwoClients, HostOrServer.Server)]
public class ConnectionMetricsTests : NetcodeIntegrationTest
internal class ConnectionMetricsTests : NetcodeIntegrationTest
{
protected override int NumberOfClients => m_ClientCount;

View File

@@ -12,7 +12,7 @@ using UnityEngine.TestTools;
namespace Unity.Netcode.RuntimeTests.Metrics
{
public class MessagingMetricsTests : DualClientMetricTestBase
internal class MessagingMetricsTests : DualClientMetricTestBase
{
private const uint k_MessageNameHashSize = 8;
// Header is dynamically sized due to packing, will be 2 bytes for all test messages.

View File

@@ -8,7 +8,7 @@ using Unity.Netcode.TestHelpers.Runtime;
namespace Unity.Netcode.RuntimeTests.Metrics
{
public class MetricsDispatchTests
internal class MetricsDispatchTests
{
private int m_NbDispatches;

View File

@@ -15,7 +15,7 @@ using UnityEngine.TestTools;
namespace Unity.Netcode.RuntimeTests.Metrics
{
public class PacketLossMetricsTests : NetcodeIntegrationTest
internal class PacketLossMetricsTests : NetcodeIntegrationTest
{
protected override int NumberOfClients => 1;
private readonly int m_PacketLossRate = 25;

View File

@@ -6,7 +6,7 @@ using Object = UnityEngine.Object;
namespace Unity.Netcode.RuntimeTests
{
public class NestedNetworkManagerTests
internal class NestedNetworkManagerTests
{
[Test]
public void CheckNestedNetworkManager()

View File

@@ -10,7 +10,7 @@ namespace Unity.Netcode.RuntimeTests
/// <summary>
/// This class is for testing general fixes or functionality of NetworkBehaviours
/// </summary>
public class NetworkBehaviourGenericTests : NetcodeIntegrationTest
internal class NetworkBehaviourGenericTests : NetcodeIntegrationTest
{
protected override int NumberOfClients => 0;
@@ -21,7 +21,7 @@ namespace Unity.Netcode.RuntimeTests
return m_AllowServerToStart;
}
public class SimpleNetworkBehaviour : NetworkBehaviour
internal class SimpleNetworkBehaviour : NetworkBehaviour
{
public bool OnNetworkDespawnCalled;

View File

@@ -0,0 +1,143 @@
using System.Collections;
using NUnit.Framework;
using Unity.Netcode.TestHelpers.Runtime;
using UnityEngine;
using UnityEngine.TestTools;
namespace Unity.Netcode.RuntimeTests
{
[TestFixture(HostOrServer.Host)]
[TestFixture(HostOrServer.DAHost)]
internal class NetworkBehaviourPrePostSpawnTests : NetcodeIntegrationTest
{
protected override int NumberOfClients => 0;
private bool m_AllowServerToStart;
private GameObject m_PrePostSpawnObject;
public NetworkBehaviourPrePostSpawnTests(HostOrServer hostOrServer) : base(hostOrServer) { }
protected override void OnServerAndClientsCreated()
{
m_PrePostSpawnObject = CreateNetworkObjectPrefab("PrePostSpawn");
// Reverse the order of the components to get inverted spawn sequence
m_PrePostSpawnObject.AddComponent<NetworkBehaviourPostSpawn>();
m_PrePostSpawnObject.AddComponent<NetworkBehaviourPreSpawn>();
base.OnServerAndClientsCreated();
}
internal class NetworkBehaviourPreSpawn : NetworkBehaviour
{
public static int ValueToSet;
public bool OnNetworkPreSpawnCalled;
public bool NetworkVarValueMatches;
public NetworkVariable<int> TestNetworkVariable;
protected override void OnNetworkPreSpawn(ref NetworkManager networkManager)
{
OnNetworkPreSpawnCalled = true;
// If we are the server, then set the randomly generated value (1-200).
// Otherwise, just set the value to 0.
// TODO: Make adjustments when integrated CMB service testing is added
var val = networkManager.IsServer ? ValueToSet : 0;
// Instantiate the NetworkVariable as everyone read & owner write while also setting the value
TestNetworkVariable = new NetworkVariable<int>(val, NetworkVariableReadPermission.Everyone, NetworkVariableWritePermission.Owner);
base.OnNetworkPreSpawn(ref networkManager);
}
public override void OnNetworkSpawn()
{
// For both client and server this should match at this point
NetworkVarValueMatches = TestNetworkVariable.Value == ValueToSet;
base.OnNetworkSpawn();
}
}
internal class NetworkBehaviourPostSpawn : NetworkBehaviour
{
public bool OnNetworkPostSpawnCalled;
private NetworkBehaviourPreSpawn m_NetworkBehaviourPreSpawn;
public int ValueSet;
public override void OnNetworkSpawn()
{
// Obtain the NetworkBehaviourPreSpawn component
// (could also do this during OnNetworkPreSpawn if we wanted)
m_NetworkBehaviourPreSpawn = GetComponent<NetworkBehaviourPreSpawn>();
base.OnNetworkSpawn();
}
protected override void OnNetworkPostSpawn()
{
OnNetworkPostSpawnCalled = true;
// We should be able to access the component we got during OnNetworkSpawn and all values should be set
// (i.e. OnNetworkSpawn run on all NetworkObject relative NetworkBehaviours)
ValueSet = m_NetworkBehaviourPreSpawn.TestNetworkVariable.Value;
base.OnNetworkPostSpawn();
}
}
protected override bool CanStartServerAndClients()
{
return m_AllowServerToStart;
}
protected override IEnumerator OnSetup()
{
m_AllowServerToStart = false;
return base.OnSetup();
}
protected override void OnNewClientCreated(NetworkManager networkManager)
{
networkManager.NetworkConfig.Prefabs = m_ServerNetworkManager.NetworkConfig.Prefabs;
base.OnNewClientCreated(networkManager);
}
/// <summary>
/// This validates that pre spawn can be used to instantiate and assign a NetworkVariable (or other prespawn tasks)
/// which can be useful for assigning a NetworkVariable value on the server side when the NetworkVariable has owner write permissions.
/// This also assures that duruing post spawn all associated NetworkBehaviours have run through the OnNetworkSpawn pass (i.e. OnNetworkSpawn order is not an issue)
/// </summary>
[UnityTest]
public IEnumerator OnNetworkPreAndPostSpawn()
{
m_AllowServerToStart = true;
NetworkBehaviourPreSpawn.ValueToSet = Random.Range(1, 200);
yield return StartServerAndClients();
yield return CreateAndStartNewClient();
// Spawn the object with the newly joined client as the owner
var networkManager = m_DistributedAuthority ? m_ServerNetworkManager : m_ClientNetworkManagers[0];
var authorityInstance = SpawnObject(m_PrePostSpawnObject, networkManager);
var authorityNetworkObject = authorityInstance.GetComponent<NetworkObject>();
var authorityPreSpawn = authorityInstance.GetComponent<NetworkBehaviourPreSpawn>();
var authorityPostSpawn = authorityInstance.GetComponent<NetworkBehaviourPostSpawn>();
yield return WaitForConditionOrTimeOut(() => s_GlobalNetworkObjects.ContainsKey(m_ClientNetworkManagers[0].LocalClientId)
&& s_GlobalNetworkObjects[m_ClientNetworkManagers[0].LocalClientId].ContainsKey(authorityNetworkObject.NetworkObjectId));
AssertOnTimeout($"Client-{m_ClientNetworkManagers[0].LocalClientId} failed to spawn {nameof(NetworkObject)} id-{authorityNetworkObject.NetworkObjectId}!");
var clientNetworkObject = s_GlobalNetworkObjects[m_ClientNetworkManagers[0].LocalClientId][authorityNetworkObject.NetworkObjectId];
var clientPreSpawn = clientNetworkObject.GetComponent<NetworkBehaviourPreSpawn>();
var clientPostSpawn = clientNetworkObject.GetComponent<NetworkBehaviourPostSpawn>();
Assert.IsTrue(authorityPreSpawn.OnNetworkPreSpawnCalled, $"[Authority-side] OnNetworkPreSpawn not invoked!");
Assert.IsTrue(clientPreSpawn.OnNetworkPreSpawnCalled, $"[Client-side] OnNetworkPreSpawn not invoked!");
Assert.IsTrue(authorityPostSpawn.OnNetworkPostSpawnCalled, $"[Authority-side] OnNetworkPostSpawn not invoked!");
Assert.IsTrue(clientPostSpawn.OnNetworkPostSpawnCalled, $"[Client-side] OnNetworkPostSpawn not invoked!");
Assert.IsTrue(authorityPreSpawn.NetworkVarValueMatches, $"[Authority-side][PreSpawn] Value {NetworkBehaviourPreSpawn.ValueToSet} does not match {authorityPreSpawn.TestNetworkVariable.Value}!");
Assert.IsTrue(clientPreSpawn.NetworkVarValueMatches, $"[Client-side][PreSpawn] Value {NetworkBehaviourPreSpawn.ValueToSet} does not match {clientPreSpawn.TestNetworkVariable.Value}!");
Assert.IsTrue(authorityPostSpawn.ValueSet == NetworkBehaviourPreSpawn.ValueToSet, $"[Authority-side][PostSpawn] Value {NetworkBehaviourPreSpawn.ValueToSet} does not match {authorityPostSpawn.ValueSet}!");
Assert.IsTrue(clientPostSpawn.ValueSet == NetworkBehaviourPreSpawn.ValueToSet, $"[Client-side][PostSpawn] Value {NetworkBehaviourPreSpawn.ValueToSet} does not match {clientPostSpawn.ValueSet}!");
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2263d66f6df15a7428d279dbdaba1519
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -12,7 +12,7 @@ namespace Unity.Netcode.RuntimeTests
/// <summary>
/// This is a refactor of the original test's NetworkBehaviour INetVarInfo derived NetworkBehaviours
/// </summary>
public class NetVarContainer : NetworkBehaviour
internal class NetVarContainer : NetworkBehaviour
{
public enum NetVarsToCheck
{
@@ -126,7 +126,7 @@ namespace Unity.Netcode.RuntimeTests
/// Used to define how many NetworkVariables to use per NetVarContainer instance.
/// There are always two
/// </summary>
public struct NetVarCombinationTypes
internal struct NetVarCombinationTypes
{
public NetVarContainer.NetVarsToCheck FirstType;
public NetVarContainer.NetVarsToCheck SecondType;
@@ -135,7 +135,7 @@ namespace Unity.Netcode.RuntimeTests
/// <summary>
/// Server and Distributed Authority modes require at least 1 client while the host does not.
/// </summary>
/// [Session Mode][Number of Clients][First NetVar Type][Second NetVar Type]
/// [Host or Server mode][Number of Clients][First NetVar Type][Second NetVar Type]
[TestFixture(HostOrServer.DAHost, 1, NetVarContainer.NetVarsToCheck.One, NetVarContainer.NetVarsToCheck.One)]
[TestFixture(HostOrServer.DAHost, 1, NetVarContainer.NetVarsToCheck.One, NetVarContainer.NetVarsToCheck.Two)]
[TestFixture(HostOrServer.DAHost, 1, NetVarContainer.NetVarsToCheck.Two, NetVarContainer.NetVarsToCheck.Two)]
@@ -157,7 +157,7 @@ namespace Unity.Netcode.RuntimeTests
[TestFixture(HostOrServer.Host, 2, NetVarContainer.NetVarsToCheck.One, NetVarContainer.NetVarsToCheck.One)]
[TestFixture(HostOrServer.Host, 2, NetVarContainer.NetVarsToCheck.One, NetVarContainer.NetVarsToCheck.Two)]
[TestFixture(HostOrServer.Host, 2, NetVarContainer.NetVarsToCheck.Two, NetVarContainer.NetVarsToCheck.Two)]
public class NetworkBehaviourUpdaterTests : NetcodeIntegrationTest
internal class NetworkBehaviourUpdaterTests : NetcodeIntegrationTest
{
// Go ahead and create maximum number of clients (not all tests will use them)
protected override int NumberOfClients => m_NumberOfClients;
@@ -202,7 +202,7 @@ namespace Unity.Netcode.RuntimeTests
// GameObject of this prefab
var netVarContainer = m_PrefabToSpawn.AddComponent<NetVarContainer>();
netVarContainer.NumberOfNetVarsToCheck = m_NetVarCombinationTypes.FirstType;
if (m_SessionModeType == SessionModeTypes.DistributedAuthority)
if (m_NetworkTopologyType == NetworkTopologyTypes.DistributedAuthority)
{
netVarContainer.SetOwnerWrite();
}
@@ -210,7 +210,7 @@ namespace Unity.Netcode.RuntimeTests
netVarContainer.ValueToSetNetVarTo = NetVarValueToSet;
netVarContainer = m_PrefabToSpawn.AddComponent<NetVarContainer>();
if (m_SessionModeType == SessionModeTypes.DistributedAuthority)
if (m_NetworkTopologyType == NetworkTopologyTypes.DistributedAuthority)
{
netVarContainer.SetOwnerWrite();
}
@@ -243,7 +243,7 @@ namespace Unity.Netcode.RuntimeTests
// the appropriate number of NetworkObjects with the NetVarContainer behaviour
var numberOfObjectsToSpawn = numToSpawn * NumberOfClients;
var authority = m_SessionModeType == SessionModeTypes.DistributedAuthority ? m_ClientNetworkManagers[0] : m_ServerNetworkManager;
var authority = m_NetworkTopologyType == NetworkTopologyTypes.DistributedAuthority ? m_ClientNetworkManagers[0] : m_ServerNetworkManager;
// spawn the objects
for (int i = 0; i < numToSpawn; i++)

View File

@@ -3,7 +3,7 @@ using UnityEngine;
namespace Unity.Netcode.RuntimeTests
{
public class NetworkManagerCustomMessageManagerTests
internal class NetworkManagerCustomMessageManagerTests
{
[Test]
public void CustomMessageManagerAssigned()

View File

@@ -7,7 +7,7 @@ using UnityEngine.TestTools;
namespace Unity.Netcode.RuntimeTests
{
public class NetworkManagerEventsTests
internal class NetworkManagerEventsTests
{
private NetworkManager m_ClientManager;
private NetworkManager m_ServerManager;

View File

@@ -3,7 +3,7 @@ using UnityEngine;
namespace Unity.Netcode.RuntimeTests
{
public class NetworkManagerSceneManagerTests
internal class NetworkManagerSceneManagerTests
{
[Test]
public void SceneManagerAssigned()

View File

@@ -6,7 +6,7 @@ using UnityEngine.TestTools;
namespace Unity.Netcode.RuntimeTests
{
public class NetworkManagerTransportTests
internal class NetworkManagerTransportTests
{
[Test]
public void ClientDoesNotStartWhenTransportFails()
@@ -106,7 +106,7 @@ namespace Unity.Netcode.RuntimeTests
/// <summary>
/// Does nothing but simulate a transport that can fail at startup and/or when polling events.
/// </summary>
public class FailedTransport : TestingNetworkTransport
internal class FailedTransport : TestingNetworkTransport
{
public bool FailOnStart = false;
public bool FailOnNextPoll = false;

View File

@@ -14,13 +14,13 @@ namespace Unity.Netcode.RuntimeTests
/// - Client destroy spawned => throw exception.
/// </summary>
[TestFixture(SessionModeTypes.DistributedAuthority)]
[TestFixture(SessionModeTypes.ClientServer)]
public class NetworkObjectDestroyTests : NetcodeIntegrationTest
[TestFixture(NetworkTopologyTypes.DistributedAuthority)]
[TestFixture(NetworkTopologyTypes.ClientServer)]
internal class NetworkObjectDestroyTests : NetcodeIntegrationTest
{
protected override int NumberOfClients => 2;
public NetworkObjectDestroyTests(SessionModeTypes sessionModeType) : base(sessionModeType) { }
public NetworkObjectDestroyTests(NetworkTopologyTypes networkTopologyType) : base(networkTopologyType) { }
/// <summary>
/// Tests that a server can destroy a NetworkObject and that it gets despawned correctly.
@@ -96,7 +96,7 @@ namespace Unity.Netcode.RuntimeTests
}
else
{
// Shutdown the
// Shutdown the
m_ClientNetworkManagers[0].Shutdown();
}
}

View File

@@ -11,7 +11,7 @@ namespace Unity.Netcode.RuntimeTests
[TestFixture(HostOrServer.DAHost)]
[TestFixture(HostOrServer.Host)]
[TestFixture(HostOrServer.Server)]
public class NetworkObjectDontDestroyWithOwnerTests : NetcodeIntegrationTest
internal class NetworkObjectDontDestroyWithOwnerTests : NetcodeIntegrationTest
{
private const int k_NumberObjectsToSpawn = 32;
protected override int NumberOfClients => 1;

View File

@@ -7,7 +7,7 @@ using UnityEngine.TestTools;
namespace Unity.Netcode.RuntimeTests
{
public class NetworkObjectNetworkClientOwnedObjectsTests : NetcodeIntegrationTest
internal class NetworkObjectNetworkClientOwnedObjectsTests : NetcodeIntegrationTest
{
private class DummyNetworkBehaviour : NetworkBehaviour
{

View File

@@ -13,7 +13,7 @@ namespace Unity.Netcode.RuntimeTests
[TestFixture(HostOrServer.DAHost)]
[TestFixture(HostOrServer.Host)]
[TestFixture(HostOrServer.Server)]
public class NetworkObjectOnNetworkDespawnTests : NetcodeIntegrationTest
internal class NetworkObjectOnNetworkDespawnTests : NetcodeIntegrationTest
{
private const string k_ObjectName = "TestDespawn";
public enum InstanceTypes

View File

@@ -7,9 +7,9 @@ using UnityEngine.TestTools;
namespace Unity.Netcode.RuntimeTests
{
[TestFixture(SessionModeTypes.DistributedAuthority)]
[TestFixture(SessionModeTypes.ClientServer)]
public class NetworkObjectOnSpawnTests : NetcodeIntegrationTest
[TestFixture(NetworkTopologyTypes.DistributedAuthority)]
[TestFixture(NetworkTopologyTypes.ClientServer)]
internal class NetworkObjectOnSpawnTests : NetcodeIntegrationTest
{
private GameObject m_TestNetworkObjectPrefab;
private GameObject m_TestNetworkObjectInstance;
@@ -29,7 +29,7 @@ namespace Unity.Netcode.RuntimeTests
private const string k_WithObserversError = "Not all clients spawned the";
private const string k_WithoutObserversError = "A client spawned the";
public NetworkObjectOnSpawnTests(SessionModeTypes sessionModeType) : base(sessionModeType) { }
public NetworkObjectOnSpawnTests(NetworkTopologyTypes networkTopologyType) : base(networkTopologyType) { }
protected override void OnServerAndClientsCreated()
{
@@ -43,7 +43,7 @@ namespace Unity.Netcode.RuntimeTests
{
if (m_ObserverTestType == ObserverTestTypes.WithObservers)
{
// When validating this portion of the test and spawning with observers is true, there
// When validating this portion of the test and spawning with observers is true, there
// should be spawned objects on the clients.
if (!s_GlobalNetworkObjects.ContainsKey(client.LocalClientId))
{
@@ -52,7 +52,7 @@ namespace Unity.Netcode.RuntimeTests
}
else
{
// When validating this portion of the test and spawning with observers is false, there
// When validating this portion of the test and spawning with observers is false, there
// should be no spawned objects on the clients.
if (s_GlobalNetworkObjects.ContainsKey(client.LocalClientId))
{

View File

@@ -8,9 +8,9 @@ using UnityEngine.TestTools;
namespace Unity.Netcode.RuntimeTests
{
[TestFixture(SessionModeTypes.DistributedAuthority)]
[TestFixture(SessionModeTypes.ClientServer)]
public class NetworkObjectOwnershipPropertiesTests : NetcodeIntegrationTest
[TestFixture(NetworkTopologyTypes.DistributedAuthority)]
[TestFixture(NetworkTopologyTypes.ClientServer)]
internal class NetworkObjectOwnershipPropertiesTests : NetcodeIntegrationTest
{
private class DummyNetworkBehaviour : NetworkBehaviour
{
@@ -30,7 +30,7 @@ namespace Unity.Netcode.RuntimeTests
private bool m_InitialOwnerOwnedBySever;
private bool m_TargetOwnerOwnedBySever;
public NetworkObjectOwnershipPropertiesTests(SessionModeTypes sessionModeType) : base(sessionModeType) { }
public NetworkObjectOwnershipPropertiesTests(NetworkTopologyTypes networkTopologyType) : base(networkTopologyType) { }
protected override IEnumerator OnTearDown()
{
@@ -186,7 +186,7 @@ namespace Unity.Netcode.RuntimeTests
yield return WaitForMessageReceived<ChangeOwnershipMessage>(m_ClientNetworkManagers.ToList());
}
// Ensure it's the ownership tables are updated
// Ensure it's the ownership tables are updated
yield return WaitForConditionOrTimeOut(OwnershipPropagated);
AssertOnTimeout($"Timed out waiting for ownership to propagate!\n{m_OwnershipPropagatedFailures}");

View File

@@ -8,7 +8,7 @@ using UnityEngine.TestTools;
namespace Unity.Netcode.RuntimeTests
{
public class NetworkObjectOwnershipComponent : NetworkBehaviour
internal class NetworkObjectOwnershipComponent : NetworkBehaviour
{
public static Dictionary<ulong, NetworkObjectOwnershipComponent> SpawnedInstances = new Dictionary<ulong, NetworkObjectOwnershipComponent>();
@@ -45,7 +45,7 @@ namespace Unity.Netcode.RuntimeTests
[TestFixture(HostOrServer.DAHost)]
[TestFixture(HostOrServer.Host)]
[TestFixture(HostOrServer.Server)]
public class NetworkObjectOwnershipTests : NetcodeIntegrationTest
internal class NetworkObjectOwnershipTests : NetcodeIntegrationTest
{
protected override int NumberOfClients => 9;

View File

@@ -7,7 +7,7 @@ namespace Unity.Netcode.RuntimeTests
/// <summary>
/// Tests properties of NetworkObject for proper functionality.
/// </summary>
public class NetworkObjectPropertyTests : NetcodeIntegrationTest
internal class NetworkObjectPropertyTests : NetcodeIntegrationTest
{
protected override int NumberOfClients => 1;

View File

@@ -7,9 +7,9 @@ using UnityEngine.TestTools;
namespace Unity.Netcode.RuntimeTests
{
[TestFixture(SessionModeTypes.ClientServer)]
[TestFixture(SessionModeTypes.DistributedAuthority)]
public class NetworkObjectSpawnManyObjectsTests : NetcodeIntegrationTest
[TestFixture(NetworkTopologyTypes.ClientServer)]
[TestFixture(NetworkTopologyTypes.DistributedAuthority)]
internal class NetworkObjectSpawnManyObjectsTests : NetcodeIntegrationTest
{
protected override int NumberOfClients => 1;
// "many" in this case means enough to exceed a ushort_max message size written in the header
@@ -18,9 +18,9 @@ namespace Unity.Netcode.RuntimeTests
private NetworkPrefab m_PrefabToSpawn;
public NetworkObjectSpawnManyObjectsTests(SessionModeTypes sessionModeType) : base(sessionModeType) { }
public NetworkObjectSpawnManyObjectsTests(NetworkTopologyTypes networkTopologyType) : base(networkTopologyType) { }
// Using this component assures we will know precisely how many prefabs were spawned on the client
public class SpawnObjecTrackingComponent : NetworkBehaviour
internal class SpawnObjecTrackingComponent : NetworkBehaviour
{
public static int SpawnedObjects;
public override void OnNetworkSpawn()

View File

@@ -14,7 +14,7 @@ namespace Unity.Netcode.RuntimeTests
[TestFixture(VariableLengthSafety.EnabledNetVarSafety, HostOrServer.Host)]
[TestFixture(VariableLengthSafety.DisableNetVarSafety, HostOrServer.Server)]
[TestFixture(VariableLengthSafety.EnabledNetVarSafety, HostOrServer.Server)]
public class NetworkObjectSynchronizationTests : NetcodeIntegrationTest
internal class NetworkObjectSynchronizationTests : NetcodeIntegrationTest
{
private const int k_NumberToSpawn = 30;
protected override int NumberOfClients => 0;
@@ -382,7 +382,7 @@ namespace Unity.Netcode.RuntimeTests
/// the synchronization process will continue (i.e. it will skip over that block
/// of the reader buffer).
/// </summary>
public class NetworkBehaviourWithNetworkVariables : NetworkBehaviour
internal class NetworkBehaviourWithNetworkVariables : NetworkBehaviour
{
public static int ServerSpawnCount { get; internal set; }
public static readonly Dictionary<ulong, int> ClientSpawnCount = new Dictionary<ulong, int>();
@@ -442,7 +442,7 @@ namespace Unity.Netcode.RuntimeTests
/// when variable length safety checks are off NetworkVariables still are updated
/// properly.
/// </summary>
public class NetworkBehaviourWithOwnerNetworkVariables : NetworkBehaviour
internal class NetworkBehaviourWithOwnerNetworkVariables : NetworkBehaviour
{
private NetworkVariableWritePermission m_NetworkVariableWritePermission = NetworkVariableWritePermission.Server;
/// <summary>
@@ -491,7 +491,7 @@ namespace Unity.Netcode.RuntimeTests
/// and provides a synchronization success version to validate that synchronization
/// will continue if user synchronization code fails.
/// </summary>
public class NetworkBehaviourSynchronizeFailureComponent : NetworkBehaviour
internal class NetworkBehaviourSynchronizeFailureComponent : NetworkBehaviour
{
public static int NumberOfFailureTypes { get; internal set; }
public static int ServerSpawnCount { get; internal set; }
@@ -661,11 +661,11 @@ namespace Unity.Netcode.RuntimeTests
}
}
public class NetworkBehaviourOnSynchronizeComponent : NetworkBehaviour
internal class NetworkBehaviourOnSynchronizeComponent : NetworkBehaviour
{
public SomeCustomSerializationData CustomSerializationData = new SomeCustomSerializationData();
public struct SomeCustomSerializationData : INetworkSerializable
internal struct SomeCustomSerializationData : INetworkSerializable
{
public uint Value1;
public bool Value2;

View File

@@ -14,7 +14,7 @@ namespace Unity.Netcode.RuntimeTests
/// Destroying a newly spawned NetworkObject instance works
/// Removing a INetworkPrefabInstanceHandler is removed and can be verified (very last check)
/// </summary>
public class NetworkPrefabHandlerTests
internal class NetworkPrefabHandlerTests
{
private const string k_TestPrefabObjectName = "NetworkPrefabTestObject";
@@ -203,7 +203,7 @@ namespace Unity.Netcode.RuntimeTests
/// <summary>
/// The Prefab instance handler to use for this test
/// </summary>
public class NetworkPrefaInstanceHandler : INetworkPrefabInstanceHandler
internal class NetworkPrefaInstanceHandler : INetworkPrefabInstanceHandler
{
private NetworkObject m_NetworkObject;

View File

@@ -9,7 +9,7 @@ using UnityEngine.TestTools;
namespace Unity.Netcode.RuntimeTests
{
public class ShowHideObject : NetworkBehaviour
internal class ShowHideObject : NetworkBehaviour
{
public static List<ShowHideObject> ClientTargetedNetworkObjects = new List<ShowHideObject>();
public static ulong ClientIdToTarget;
@@ -126,9 +126,9 @@ namespace Unity.Netcode.RuntimeTests
}
}
[TestFixture(SessionModeTypes.ClientServer)]
[TestFixture(SessionModeTypes.DistributedAuthority)]
public class NetworkShowHideTests : NetcodeIntegrationTest
[TestFixture(NetworkTopologyTypes.ClientServer)]
[TestFixture(NetworkTopologyTypes.DistributedAuthority)]
internal class NetworkShowHideTests : NetcodeIntegrationTest
{
protected override int NumberOfClients => 4;
@@ -143,7 +143,7 @@ namespace Unity.Netcode.RuntimeTests
private NetworkObject m_Object2OnClient0;
private NetworkObject m_Object3OnClient0;
public NetworkShowHideTests(SessionModeTypes sessionModeType) : base(sessionModeType) { }
public NetworkShowHideTests(NetworkTopologyTypes networkTopologyType) : base(networkTopologyType) { }
protected override void OnServerAndClientsCreated()
{

View File

@@ -7,7 +7,7 @@ namespace Unity.Netcode.RuntimeTests
{
[TestFixture(HostOrServer.DAHost)]
[TestFixture(HostOrServer.Host)]
public class NetworkSpawnManagerTests : NetcodeIntegrationTest
internal class NetworkSpawnManagerTests : NetcodeIntegrationTest
{
private ulong serverSideClientId => NetworkManager.ServerClientId;
private ulong clientSideClientId => m_ClientNetworkManagers[0].LocalClientId;
@@ -52,7 +52,7 @@ namespace Unity.Netcode.RuntimeTests
{
if (m_DistributedAuthority)
{
VerboseDebug($"Ignoring test: Clients have access to other player objects in {m_SessionModeType} mode.");
VerboseDebug($"Ignoring test: Clients have access to other player objects in {m_NetworkTopologyType} mode.");
return;
}
// client can't access server player
@@ -77,7 +77,7 @@ namespace Unity.Netcode.RuntimeTests
if (!m_DistributedAuthority)
{
VerboseDebug($"Ignoring test: Clients do not have access to other player objects in {m_SessionModeType} mode.");
VerboseDebug($"Ignoring test: Clients do not have access to other player objects in {m_NetworkTopologyType} mode.");
return;
}
@@ -90,7 +90,7 @@ namespace Unity.Netcode.RuntimeTests
{
if (m_DistributedAuthority)
{
VerboseDebug($"Ignoring test: Clients have access to other player objects in {m_SessionModeType} mode.");
VerboseDebug($"Ignoring test: Clients have access to other player objects in {m_NetworkTopologyType} mode.");
return;
}

View File

@@ -9,7 +9,7 @@ using UnityEngine;
namespace Unity.Netcode.RuntimeTests
{
public class NetworkTransformBase : IntegrationTestWithApproximation
internal class NetworkTransformBase : IntegrationTestWithApproximation
{
// The number of iterations to change position, rotation, and scale for NetworkTransformMultipleChangesOverTime
@@ -731,7 +731,7 @@ namespace Unity.Netcode.RuntimeTests
/// <summary>
/// Helper component for all NetworkTransformTests
/// </summary>
public class NetworkTransformTestComponent : NetworkTransform
internal class NetworkTransformTestComponent : NetworkTransform
{
public bool ServerAuthority;
public bool ReadyToReceivePositionUpdate = false;
@@ -794,7 +794,7 @@ namespace Unity.Netcode.RuntimeTests
/// Helper component for NetworkTransform parenting tests when
/// a child is a parent of another child (i.e. "sub child")
/// </summary>
public class SubChildObjectComponent : ChildObjectComponent
internal class SubChildObjectComponent : ChildObjectComponent
{
protected override bool IsSubChild()
{
@@ -805,7 +805,7 @@ namespace Unity.Netcode.RuntimeTests
/// <summary>
/// Helper component for NetworkTransform parenting tests
/// </summary>
public class ChildObjectComponent : NetworkTransform
internal class ChildObjectComponent : NetworkTransform
{
public static int TestCount;
public static bool EnableChildLog;

View File

@@ -6,7 +6,7 @@ namespace Unity.Netcode.RuntimeTests
{
[TestFixture(HostOrServer.Host, Authority.OwnerAuthority)]
[TestFixture(HostOrServer.Host, Authority.ServerAuthority)]
public class NetworkTransformGeneral : NetworkTransformBase
internal class NetworkTransformGeneral : NetworkTransformBase
{
public NetworkTransformGeneral(HostOrServer testWithHost, Authority authority) :
base(testWithHost, authority, RotationCompression.None, Rotation.Euler, Precision.Full)
@@ -66,7 +66,7 @@ namespace Unity.Netcode.RuntimeTests
var halfThreshold = m_AuthoritativeTransform.RotAngleThreshold * 0.5001f;
// Apply the current state prior to getting reference rotations which assures we have
// applied the most current rotation deltas and that all bitset flags are updated
// applied the most current rotation deltas and that all bitset flags are updated
var results = m_AuthoritativeTransform.ApplyState();
TimeTravelAdvanceTick();

View File

@@ -12,7 +12,7 @@ namespace Unity.Netcode.RuntimeTests
[TestFixture(HostOrServer.DAHost, MotionModels.UseTransform)]
[TestFixture(HostOrServer.DAHost, MotionModels.UseRigidbody)]
[TestFixture(HostOrServer.Host, MotionModels.UseTransform)]
public class NetworkTransformOwnershipTests : IntegrationTestWithApproximation
internal class NetworkTransformOwnershipTests : IntegrationTestWithApproximation
{
public enum MotionModels
{
@@ -447,7 +447,7 @@ namespace Unity.Netcode.RuntimeTests
/// <summary>
/// NetworkTransformOwnershipTests helper behaviour
/// </summary>
public class VerifyObjectIsSpawnedOnClient : NetworkBehaviour
internal class VerifyObjectIsSpawnedOnClient : NetworkBehaviour
{
public static Dictionary<ulong, VerifyObjectIsSpawnedOnClient> NetworkManagerRelativeSpawnedObjects = new Dictionary<ulong, VerifyObjectIsSpawnedOnClient>();
@@ -512,7 +512,7 @@ namespace Unity.Netcode.RuntimeTests
/// This will have to be used to verify the ownership authority
/// </summary>
[DisallowMultipleComponent]
public class TestClientNetworkTransform : NetworkTransform
internal class TestClientNetworkTransform : NetworkTransform
{
//public override void OnNetworkSpawn()
//{

View File

@@ -26,7 +26,7 @@ namespace Unity.Netcode.RuntimeTests
[TestFixture(HostOrServer.Host, Authority.ServerAuthority, RotationCompression.None, Rotation.Quaternion, Precision.Half)]
[TestFixture(HostOrServer.Host, Authority.ServerAuthority, RotationCompression.QuaternionCompress, Rotation.Quaternion, Precision.Full)]
[TestFixture(HostOrServer.Host, Authority.ServerAuthority, RotationCompression.QuaternionCompress, Rotation.Quaternion, Precision.Half)]
public class NetworkTransformPacketLossTests : NetworkTransformBase
internal class NetworkTransformPacketLossTests : NetworkTransformBase
{
private const int k_Latency = 50;
private const int k_PacketLoss = 2;
@@ -490,7 +490,7 @@ namespace Unity.Netcode.RuntimeTests
// Match the first position update
if (Approximately(m_RandomPosition, networkTransformState.GetPosition()))
{
// Teleport to the m_RandomPosition plus the
// Teleport to the m_RandomPosition plus the
m_AuthoritativeTransform.SetState(m_TeleportOffset + m_RandomPosition, null, null, false);
m_AuthoritativeTransform.AuthorityPushedTransformState -= OnAuthorityPushedTransformState;
m_Teleported = true;

View File

@@ -15,7 +15,7 @@ namespace Unity.Netcode.RuntimeTests
[TestFixture(TransformSpace.World, Precision.Half, Rotation.Quaternion)]
[TestFixture(TransformSpace.Local, Precision.Full, Rotation.Quaternion)]
[TestFixture(TransformSpace.Local, Precision.Half, Rotation.Quaternion)]
public class NetworkTransformStateTests
internal class NetworkTransformStateTests
{
public enum SyncAxis
{

View File

@@ -33,7 +33,7 @@ namespace Unity.Netcode.RuntimeTests
[TestFixture(HostOrServer.Host, Authority.OwnerAuthority, RotationCompression.QuaternionCompress, Rotation.Quaternion, Precision.Full)]
[TestFixture(HostOrServer.Host, Authority.OwnerAuthority, RotationCompression.QuaternionCompress, Rotation.Quaternion, Precision.Half)]
#endif
public class NetworkTransformTests : NetworkTransformBase
internal class NetworkTransformTests : NetworkTransformBase
{
protected const int k_TickRate = 60;
/// <summary>
@@ -311,7 +311,7 @@ namespace Unity.Netcode.RuntimeTests
Assert.True(WaitForConditionOrTimeOutWithTimeTravel(() => m_AuthoritativeTransform.StatePushed && m_NonAuthoritativeTransform.StateUpdated), $"[Non-Interpolate {i}] Timed out waiting for state to be pushed ({m_AuthoritativeTransform.StatePushed}) or state to be updated ({m_NonAuthoritativeTransform.StateUpdated})!");
// For 3 axis, we will skip validating that the non-authority interpolates to its target point at least once.
// This will validate that non-authoritative updates are maintaining their target state axis values if only 2
// This will validate that non-authoritative updates are maintaining their target state axis values if only 2
// of the axis are being updated to assure interpolation maintains the targeted axial value per axis.
// For 2 and 1 axis tests we always validate per delta update
if (m_AxisExcluded || axisCount < 3)

View File

@@ -9,7 +9,7 @@ using UnityEngine.TestTools;
namespace Unity.Netcode.RuntimeTests
{
public class NetworkUpdateLoopTests
internal class NetworkUpdateLoopTests
{
[Test]
public void RegisterCustomLoopInTheMiddle()

View File

@@ -8,9 +8,9 @@ namespace Unity.Netcode.RuntimeTests
{
[TestFixture(HostOrServer.DAHost)]
[TestFixture(HostOrServer.Host)]
public class NetworkVarBufferCopyTest : NetcodeIntegrationTest
internal class NetworkVarBufferCopyTest : NetcodeIntegrationTest
{
public class DummyNetVar : NetworkVariableBase
internal class DummyNetVar : NetworkVariableBase
{
private const int k_DummyValue = 0x13579BDF;
public bool DeltaWritten;
@@ -75,7 +75,7 @@ namespace Unity.Netcode.RuntimeTests
NetworkVariableWritePermission writePerm = DefaultWritePerm) : base(readPerm, writePerm) { }
}
public class DummyNetBehaviour : NetworkBehaviour
internal class DummyNetBehaviour : NetworkBehaviour
{
public static bool DistributedAuthority;
public DummyNetVar NetVar;

View File

@@ -13,7 +13,7 @@ using Random = UnityEngine.Random;
namespace Unity.Netcode.RuntimeTests
{
[TestFixtureSource(nameof(TestDataSource))]
public class NetworkVariablePermissionTests : NetcodeIntegrationTest
internal class NetworkVariablePermissionTests : NetcodeIntegrationTest
{
public static IEnumerable<TestFixtureData> TestDataSource()
{
@@ -304,7 +304,7 @@ namespace Unity.Netcode.RuntimeTests
}
}
public struct TestStruct : INetworkSerializable, IEquatable<TestStruct>
internal struct TestStruct : INetworkSerializable, IEquatable<TestStruct>
{
public uint SomeInt;
public bool SomeBool;
@@ -344,7 +344,7 @@ namespace Unity.Netcode.RuntimeTests
}
}
public class TestClass : INetworkSerializable, IEquatable<TestClass>
internal class TestClass : INetworkSerializable, IEquatable<TestClass>
{
public uint SomeInt;
public bool SomeBool;
@@ -386,12 +386,12 @@ namespace Unity.Netcode.RuntimeTests
// Used just to create a NetworkVariable in the templated NetworkBehaviour type that isn't referenced anywhere else
// Please do not reference this class anywhere else!
public class TestClass_ReferencedOnlyByTemplateNetworkBehavourType : TestClass
internal class TestClass_ReferencedOnlyByTemplateNetworkBehavourType : TestClass
{
}
public class NetworkVariableTest : NetworkBehaviour
internal class NetworkVariableTest : NetworkBehaviour
{
public enum SomeEnum
{
@@ -440,7 +440,7 @@ namespace Unity.Netcode.RuntimeTests
[TestFixture(true)]
#endif
[TestFixture(false)]
public class NetworkVariableTests : NetcodeIntegrationTest
internal class NetworkVariableTests : NetcodeIntegrationTest
{
private const string k_StringTestValue = "abcdefghijklmnopqrstuvwxyz";
private static readonly FixedString32Bytes k_FixedStringTestValue = k_StringTestValue;
@@ -5130,7 +5130,7 @@ namespace Unity.Netcode.RuntimeTests
/// that accepts anything derived from the <see cref="ConditionalPredicateBase"/> class
/// as a parameter.
/// </summary>
public class NetworkListTestPredicate : ConditionalPredicateBase
internal class NetworkListTestPredicate : ConditionalPredicateBase
{
private const int k_MaxRandomValue = 1000;
@@ -5296,7 +5296,7 @@ namespace Unity.Netcode.RuntimeTests
}
[TestFixtureSource(nameof(TestDataSource))]
public class NetworkVariableInheritanceTests : NetcodeIntegrationTest
internal class NetworkVariableInheritanceTests : NetcodeIntegrationTest
{
public NetworkVariableInheritanceTests(HostOrServer hostOrServer)
: base(hostOrServer)
@@ -5308,7 +5308,7 @@ namespace Unity.Netcode.RuntimeTests
public static IEnumerable<TestFixtureData> TestDataSource() =>
Enum.GetValues(typeof(HostOrServer)).OfType<HostOrServer>().Select(x => new TestFixtureData(x));
public class ComponentA : NetworkBehaviour
internal class ComponentA : NetworkBehaviour
{
public NetworkVariable<int> PublicFieldA = new NetworkVariable<int>(1);
protected NetworkVariable<int> m_ProtectedFieldA = new NetworkVariable<int>(2);
@@ -5329,7 +5329,7 @@ namespace Unity.Netcode.RuntimeTests
}
}
public class ComponentB : ComponentA
internal class ComponentB : ComponentA
{
public NetworkVariable<int> PublicFieldB = new NetworkVariable<int>(11);
protected NetworkVariable<int> m_ProtectedFieldB = new NetworkVariable<int>(22);
@@ -5350,7 +5350,7 @@ namespace Unity.Netcode.RuntimeTests
}
}
public class ComponentC : ComponentB
internal class ComponentC : ComponentB
{
public NetworkVariable<int> PublicFieldC = new NetworkVariable<int>(111);
protected NetworkVariable<int> m_ProtectedFieldC = new NetworkVariable<int>(222);
@@ -5447,7 +5447,7 @@ namespace Unity.Netcode.RuntimeTests
}
}
public class NetvarDespawnShutdown : NetworkBehaviour
internal class NetvarDespawnShutdown : NetworkBehaviour
{
private NetworkVariable<int> m_IntNetworkVariable = new NetworkVariable<int>();
private NetworkList<int> m_IntList;
@@ -5475,7 +5475,7 @@ namespace Unity.Netcode.RuntimeTests
/// Validates that setting values for NetworkVariable or NetworkList during the
/// OnNetworkDespawn method will not cause an exception to occur.
/// </summary>
public class NetworkVariableModifyOnNetworkDespawn : NetcodeIntegrationTest
internal class NetworkVariableModifyOnNetworkDespawn : NetcodeIntegrationTest
{
protected override int NumberOfClients => 1;

View File

@@ -5,24 +5,24 @@ using UnityEngine;
namespace Unity.Netcode.RuntimeTests
{
public class NetVarPermTestComp : NetworkBehaviour
internal class NetVarPermTestComp : NetworkBehaviour
{
public NetworkVariable<Vector3> OwnerWritable_Position = new NetworkVariable<Vector3>(Vector3.one, NetworkVariableBase.DefaultReadPerm, NetworkVariableWritePermission.Owner);
public NetworkVariable<Vector3> ServerWritable_Position = new NetworkVariable<Vector3>(Vector3.one, NetworkVariableBase.DefaultReadPerm, NetworkVariableWritePermission.Server);
public NetworkVariable<Vector3> OwnerReadWrite_Position = new NetworkVariable<Vector3>(Vector3.one, NetworkVariableReadPermission.Owner, NetworkVariableWritePermission.Owner);
}
public class NetworkVariableMiddleclass<TMiddleclassName> : NetworkVariable<TMiddleclassName>
internal class NetworkVariableMiddleclass<TMiddleclassName> : NetworkVariable<TMiddleclassName>
{
}
public class NetworkVariableSubclass<TSubclassName> : NetworkVariableMiddleclass<TSubclassName>
internal class NetworkVariableSubclass<TSubclassName> : NetworkVariableMiddleclass<TSubclassName>
{
}
public class NetworkBehaviourWithNetVarArray : NetworkBehaviour
internal class NetworkBehaviourWithNetVarArray : NetworkBehaviour
{
public NetworkVariable<int> Int0 = new NetworkVariable<int>();
public NetworkVariable<int> Int1 = new NetworkVariable<int>();
@@ -123,7 +123,7 @@ namespace Unity.Netcode.RuntimeTests
}
}
public struct TemplatedValueOnlyReferencedByNetworkVariableSubclass<T> : INetworkSerializeByMemcpy
internal struct TemplatedValueOnlyReferencedByNetworkVariableSubclass<T> : INetworkSerializeByMemcpy
where T : unmanaged
{
public T Value;
@@ -178,7 +178,7 @@ namespace Unity.Netcode.RuntimeTests
C = ulong.MaxValue
}
public struct HashableNetworkVariableTestStruct : INetworkSerializeByMemcpy, IEquatable<HashableNetworkVariableTestStruct>
internal struct HashableNetworkVariableTestStruct : INetworkSerializeByMemcpy, IEquatable<HashableNetworkVariableTestStruct>
{
public byte A;
public short B;
@@ -220,7 +220,7 @@ namespace Unity.Netcode.RuntimeTests
}
}
public struct HashMapKeyStruct : INetworkSerializeByMemcpy, IEquatable<HashMapKeyStruct>
internal struct HashMapKeyStruct : INetworkSerializeByMemcpy, IEquatable<HashMapKeyStruct>
{
public byte A;
public short B;
@@ -262,7 +262,7 @@ namespace Unity.Netcode.RuntimeTests
}
}
public struct HashMapValStruct : INetworkSerializeByMemcpy, IEquatable<HashMapValStruct>
internal struct HashMapValStruct : INetworkSerializeByMemcpy, IEquatable<HashMapValStruct>
{
public byte A;
public short B;
@@ -304,7 +304,7 @@ namespace Unity.Netcode.RuntimeTests
}
}
public struct NetworkVariableTestStruct : INetworkSerializeByMemcpy
internal struct NetworkVariableTestStruct : INetworkSerializeByMemcpy
{
public byte A;
public short B;
@@ -342,7 +342,7 @@ namespace Unity.Netcode.RuntimeTests
}
public class HashableNetworkVariableTestClass : INetworkSerializable, IEquatable<HashableNetworkVariableTestClass>
internal class HashableNetworkVariableTestClass : INetworkSerializable, IEquatable<HashableNetworkVariableTestClass>
{
public HashableNetworkVariableTestStruct Data;
@@ -367,7 +367,7 @@ namespace Unity.Netcode.RuntimeTests
}
}
public class HashMapKeyClass : INetworkSerializable, IEquatable<HashMapKeyClass>
internal class HashMapKeyClass : INetworkSerializable, IEquatable<HashMapKeyClass>
{
public HashMapKeyStruct Data;
@@ -392,7 +392,7 @@ namespace Unity.Netcode.RuntimeTests
}
}
public class HashMapValClass : INetworkSerializable, IEquatable<HashMapValClass>
internal class HashMapValClass : INetworkSerializable, IEquatable<HashMapValClass>
{
public HashMapValStruct Data;
@@ -417,7 +417,7 @@ namespace Unity.Netcode.RuntimeTests
}
}
public class NetworkVariableTestClass : INetworkSerializable, IEquatable<NetworkVariableTestClass>
internal class NetworkVariableTestClass : INetworkSerializable, IEquatable<NetworkVariableTestClass>
{
public NetworkVariableTestStruct Data;
@@ -446,7 +446,7 @@ namespace Unity.Netcode.RuntimeTests
// The ILPP code for NetworkVariables to determine how to serialize them relies on them existing as fields of a NetworkBehaviour to find them.
// Some of the tests below create NetworkVariables on the stack, so this class is here just to make sure the relevant types are all accounted for.
public class NetVarILPPClassForTests : NetworkBehaviour
internal class NetVarILPPClassForTests : NetworkBehaviour
{
public NetworkVariable<byte> ByteVar;
public NetworkVariable<NativeArray<byte>> ByteArrayVar;
@@ -887,34 +887,34 @@ namespace Unity.Netcode.RuntimeTests
public NetworkVariableSubclass<TemplatedValueOnlyReferencedByNetworkVariableSubclass<int>> SubclassVar;
}
public class TemplateNetworkBehaviourType<T> : NetworkBehaviour
internal class TemplateNetworkBehaviourType<T> : NetworkBehaviour
{
public NetworkVariable<T> TheVar;
}
public class IntermediateNetworkBehavior<T> : TemplateNetworkBehaviourType<T>
internal class IntermediateNetworkBehavior<T> : TemplateNetworkBehaviourType<T>
{
public NetworkVariable<T> TheVar2;
}
#if !NGO_MINIMALPROJECT
public class ClassHavingNetworkBehaviour : IntermediateNetworkBehavior<TestClass>
internal class ClassHavingNetworkBehaviour : IntermediateNetworkBehavior<TestClass>
{
}
// Please do not reference TestClass_ReferencedOnlyByTemplateNetworkBehavourType anywhere other than here!
public class ClassHavingNetworkBehaviour2 : TemplateNetworkBehaviourType<TestClass_ReferencedOnlyByTemplateNetworkBehavourType>
internal class ClassHavingNetworkBehaviour2 : TemplateNetworkBehaviourType<TestClass_ReferencedOnlyByTemplateNetworkBehavourType>
{
}
public class StructHavingNetworkBehaviour : TemplateNetworkBehaviourType<TestStruct>
internal class StructHavingNetworkBehaviour : TemplateNetworkBehaviourType<TestStruct>
{
}
#endif
public struct StructUsedOnlyInNetworkList : IEquatable<StructUsedOnlyInNetworkList>, INetworkSerializeByMemcpy
internal struct StructUsedOnlyInNetworkList : IEquatable<StructUsedOnlyInNetworkList>, INetworkSerializeByMemcpy
{
public int Value;

View File

@@ -9,15 +9,15 @@ using Object = UnityEngine.Object;
namespace Unity.Netcode.RuntimeTests
{
public struct MyTypeOne
internal struct MyTypeOne
{
public int Value;
}
public struct MyTypeTwo
internal struct MyTypeTwo
{
public int Value;
}
public struct MyTypeThree
internal struct MyTypeThree
{
public int Value;
}
@@ -25,7 +25,7 @@ namespace Unity.Netcode.RuntimeTests
/// <summary>
/// Used to help track instances of any child derived class
/// </summary>
public class WorkingUserNetworkVariableComponentBase : NetworkBehaviour
internal class WorkingUserNetworkVariableComponentBase : NetworkBehaviour
{
private static Dictionary<ulong, WorkingUserNetworkVariableComponentBase> s_Instances = new Dictionary<ulong, WorkingUserNetworkVariableComponentBase>();
@@ -68,16 +68,16 @@ namespace Unity.Netcode.RuntimeTests
}
}
public class WorkingUserNetworkVariableComponent : WorkingUserNetworkVariableComponentBase
internal class WorkingUserNetworkVariableComponent : WorkingUserNetworkVariableComponentBase
{
public NetworkVariable<MyTypeOne> NetworkVariable = new NetworkVariable<MyTypeOne>();
}
public class WorkingUserNetworkVariableComponentUsingExtensionMethod : WorkingUserNetworkVariableComponentBase
internal class WorkingUserNetworkVariableComponentUsingExtensionMethod : WorkingUserNetworkVariableComponentBase
{
public NetworkVariable<MyTypeTwo> NetworkVariable = new NetworkVariable<MyTypeTwo>();
}
public class NonWorkingUserNetworkVariableComponent : NetworkBehaviour
internal class NonWorkingUserNetworkVariableComponent : NetworkBehaviour
{
public NetworkVariable<MyTypeThree> NetworkVariable = new NetworkVariable<MyTypeThree>();
}
@@ -96,7 +96,7 @@ namespace Unity.Netcode.RuntimeTests
}
}
public class NetworkVariableUserSerializableTypesTests : NetcodeIntegrationTest
internal class NetworkVariableUserSerializableTypesTests : NetcodeIntegrationTest
{
protected override int NumberOfClients => 1;

View File

@@ -7,18 +7,18 @@ using UnityEngine.TestTools;
namespace Unity.Netcode.RuntimeTests
{
[TestFixture(SceneManagementState.SceneManagementEnabled, SessionModeTypes.DistributedAuthority)]
[TestFixture(SceneManagementState.SceneManagementDisabled, SessionModeTypes.DistributedAuthority)]
[TestFixture(SceneManagementState.SceneManagementEnabled, SessionModeTypes.ClientServer)]
[TestFixture(SceneManagementState.SceneManagementDisabled, SessionModeTypes.ClientServer)]
public class NetworkVisibilityTests : NetcodeIntegrationTest
[TestFixture(SceneManagementState.SceneManagementEnabled, NetworkTopologyTypes.DistributedAuthority)]
[TestFixture(SceneManagementState.SceneManagementDisabled, NetworkTopologyTypes.DistributedAuthority)]
[TestFixture(SceneManagementState.SceneManagementEnabled, NetworkTopologyTypes.ClientServer)]
[TestFixture(SceneManagementState.SceneManagementDisabled, NetworkTopologyTypes.ClientServer)]
internal class NetworkVisibilityTests : NetcodeIntegrationTest
{
protected override int NumberOfClients => 1;
private GameObject m_TestNetworkPrefab;
private bool m_SceneManagementEnabled;
public NetworkVisibilityTests(SceneManagementState sceneManagementState, SessionModeTypes sessionModeType) : base(sessionModeType)
public NetworkVisibilityTests(SceneManagementState sceneManagementState, NetworkTopologyTypes networkTopologyType) : base(networkTopologyType)
{
m_SceneManagementEnabled = sceneManagementState == SceneManagementState.SceneManagementEnabled;
}

View File

@@ -12,7 +12,7 @@ namespace Unity.Netcode.RuntimeTests
// Where the NetworkVariable updates would be repeated on some clients.
// The twist comes fom the updates needing to happens very specifically for the issue to repro in tests
public class OwnerModifiedObject : NetworkBehaviour, INetworkUpdateSystem
internal class OwnerModifiedObject : NetworkBehaviour, INetworkUpdateSystem
{
public NetworkList<int> MyNetworkList;
@@ -76,7 +76,7 @@ namespace Unity.Netcode.RuntimeTests
[TestFixture(HostOrServer.DAHost)]
[TestFixture(HostOrServer.Host)]
public class OwnerModifiedTests : NetcodeIntegrationTest
internal class OwnerModifiedTests : NetcodeIntegrationTest
{
protected override int NumberOfClients => 2;

View File

@@ -7,7 +7,7 @@ using UnityEngine.TestTools;
namespace Unity.Netcode.RuntimeTests
{
public class OwnerPermissionObject : NetworkBehaviour
internal class OwnerPermissionObject : NetworkBehaviour
{
// indexed by [object, machine]
public static OwnerPermissionObject[,] Objects = new OwnerPermissionObject[3, 3];
@@ -85,7 +85,7 @@ namespace Unity.Netcode.RuntimeTests
}
}
public class OwnerPermissionHideTests : NetcodeIntegrationTest
internal class OwnerPermissionHideTests : NetcodeIntegrationTest
{
protected override int NumberOfClients => 2;

View File

@@ -21,7 +21,7 @@ namespace Unity.Netcode.RuntimeTests
/// </summary>
[TestFixture(HostOrServer.Server)]
[TestFixture(HostOrServer.Host)]
public class PeerDisconnectCallbackTests : NetcodeIntegrationTest
internal class PeerDisconnectCallbackTests : NetcodeIntegrationTest
{
public enum ClientDisconnectType

View File

@@ -8,12 +8,12 @@ using Unity.Netcode.TestHelpers.Runtime;
namespace Unity.Netcode.RuntimeTests
{
public class NetworkRigidbody2DDynamicTest : NetworkRigidbody2DTestBase
internal class NetworkRigidbody2DDynamicTest : NetworkRigidbody2DTestBase
{
public override bool Kinematic => false;
}
public class NetworkRigidbody2DKinematicTest : NetworkRigidbody2DTestBase
internal class NetworkRigidbody2DKinematicTest : NetworkRigidbody2DTestBase
{
public override bool Kinematic => true;
}

View File

@@ -13,7 +13,7 @@ namespace Unity.Netcode.RuntimeTests
[TestFixture(RigidbodyInterpolation.Extrapolate, false, true)] // This should allow extrapolation on non-auth instances when using Rigidbody & NT has no interpolation
[TestFixture(RigidbodyInterpolation.Interpolate, true, false)] // This should not allow kinematic instances to have Rigidbody interpolation enabled
[TestFixture(RigidbodyInterpolation.Interpolate, false, false)] // Testing that rigid body interpolation remains the same if NT interpolate is disabled
public class NetworkRigidbodyTest : NetcodeIntegrationTest
internal class NetworkRigidbodyTest : NetcodeIntegrationTest
{
protected override int NumberOfClients => 1;
private bool m_NetworkTransformInterpolate;

View File

@@ -9,7 +9,7 @@ namespace Unity.Netcode.RuntimeTests
[TestFixture(HostOrServer.DAHost)]
[TestFixture(HostOrServer.Host)]
[TestFixture(HostOrServer.Server)]
public class PlayerObjectTests : NetcodeIntegrationTest
internal class PlayerObjectTests : NetcodeIntegrationTest
{
protected override int NumberOfClients => 1;

Some files were not shown because too many files have changed in this diff Show More