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:
@@ -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
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace Unity.Netcode.RuntimeTests
|
||||
{
|
||||
public class NetworkVisibilityComponent : NetworkBehaviour
|
||||
internal class NetworkVisibilityComponent : NetworkBehaviour
|
||||
{
|
||||
public void Hide()
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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 });
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ using UnityEngine.TestTools;
|
||||
|
||||
namespace Unity.Netcode.RuntimeTests
|
||||
{
|
||||
public class NamedMessageTests : NetcodeIntegrationTest
|
||||
internal class NamedMessageTests : NetcodeIntegrationTest
|
||||
{
|
||||
protected override int NumberOfClients => 2;
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ using UnityEngine.TestTools;
|
||||
|
||||
namespace Unity.Netcode.RuntimeTests
|
||||
{
|
||||
public class UnnamedMessageTests : NetcodeIntegrationTest
|
||||
internal class UnnamedMessageTests : NetcodeIntegrationTest
|
||||
{
|
||||
protected override int NumberOfClients => 2;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -8,7 +8,7 @@ using Unity.Netcode.TestHelpers.Runtime;
|
||||
|
||||
namespace Unity.Netcode.RuntimeTests.Metrics
|
||||
{
|
||||
public class MetricsDispatchTests
|
||||
internal class MetricsDispatchTests
|
||||
{
|
||||
private int m_NbDispatches;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -6,7 +6,7 @@ using Object = UnityEngine.Object;
|
||||
|
||||
namespace Unity.Netcode.RuntimeTests
|
||||
{
|
||||
public class NestedNetworkManagerTests
|
||||
internal class NestedNetworkManagerTests
|
||||
{
|
||||
[Test]
|
||||
public void CheckNestedNetworkManager()
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
143
Tests/Runtime/NetworkBehaviourPrePostSpawnTests.cs
Normal file
143
Tests/Runtime/NetworkBehaviourPrePostSpawnTests.cs
Normal 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}!");
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Tests/Runtime/NetworkBehaviourPrePostSpawnTests.cs.meta
Normal file
11
Tests/Runtime/NetworkBehaviourPrePostSpawnTests.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2263d66f6df15a7428d279dbdaba1519
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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++)
|
||||
|
||||
@@ -3,7 +3,7 @@ using UnityEngine;
|
||||
|
||||
namespace Unity.Netcode.RuntimeTests
|
||||
{
|
||||
public class NetworkManagerCustomMessageManagerTests
|
||||
internal class NetworkManagerCustomMessageManagerTests
|
||||
{
|
||||
[Test]
|
||||
public void CustomMessageManagerAssigned()
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -3,7 +3,7 @@ using UnityEngine;
|
||||
|
||||
namespace Unity.Netcode.RuntimeTests
|
||||
{
|
||||
public class NetworkManagerSceneManagerTests
|
||||
internal class NetworkManagerSceneManagerTests
|
||||
{
|
||||
[Test]
|
||||
public void SceneManagerAssigned()
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -7,7 +7,7 @@ using UnityEngine.TestTools;
|
||||
|
||||
namespace Unity.Netcode.RuntimeTests
|
||||
{
|
||||
public class NetworkObjectNetworkClientOwnedObjectsTests : NetcodeIntegrationTest
|
||||
internal class NetworkObjectNetworkClientOwnedObjectsTests : NetcodeIntegrationTest
|
||||
{
|
||||
private class DummyNetworkBehaviour : NetworkBehaviour
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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))
|
||||
{
|
||||
|
||||
@@ -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}");
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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()
|
||||
//{
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -9,7 +9,7 @@ using UnityEngine.TestTools;
|
||||
|
||||
namespace Unity.Netcode.RuntimeTests
|
||||
{
|
||||
public class NetworkUpdateLoopTests
|
||||
internal class NetworkUpdateLoopTests
|
||||
{
|
||||
[Test]
|
||||
public void RegisterCustomLoopInTheMiddle()
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ using Unity.Netcode.TestHelpers.Runtime;
|
||||
|
||||
namespace Unity.Netcode.RuntimeTests
|
||||
{
|
||||
public sealed class NetworkVariableNameTests
|
||||
internal sealed class NetworkVariableNameTests
|
||||
{
|
||||
private NetworkVariableNameComponent m_NetworkVariableNameComponent;
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ using UnityEngine;
|
||||
|
||||
namespace Unity.Netcode.RuntimeTests
|
||||
{
|
||||
public class RpcManyClientsObject : NetworkBehaviour
|
||||
internal class RpcManyClientsObject : NetworkBehaviour
|
||||
{
|
||||
public int Count = 0;
|
||||
public List<ulong> ReceivedFrom = new List<ulong>();
|
||||
@@ -43,7 +43,7 @@ namespace Unity.Netcode.RuntimeTests
|
||||
}
|
||||
}
|
||||
|
||||
public class RpcManyClientsTests : NetcodeIntegrationTest
|
||||
internal class RpcManyClientsTests : NetcodeIntegrationTest
|
||||
{
|
||||
protected override int NumberOfClients => 10;
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Unity.Netcode.RuntimeTests
|
||||
/// - That all RPCs invoke at the appropriate `NetworkUpdateStage` (Client and Server)
|
||||
/// - A lower level `MessageQueueContainer` test that validates `MessageQueueFrameItems` after they have been put into the queue
|
||||
/// </summary>
|
||||
public class RpcQueueTests
|
||||
internal class RpcQueueTests
|
||||
{
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
|
||||
@@ -9,14 +9,14 @@ using Vector3 = UnityEngine.Vector3;
|
||||
|
||||
namespace Unity.Netcode.RuntimeTests
|
||||
{
|
||||
public class RpcTests : NetcodeIntegrationTest
|
||||
internal class RpcTests : NetcodeIntegrationTest
|
||||
{
|
||||
public class CompileTimeNoRpcsBaseClassTest : NetworkBehaviour
|
||||
internal class CompileTimeNoRpcsBaseClassTest : NetworkBehaviour
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public class CompileTimeHasRpcsChildClassDerivedFromNoRpcsBaseClassTest : CompileTimeNoRpcsBaseClassTest
|
||||
internal class CompileTimeHasRpcsChildClassDerivedFromNoRpcsBaseClassTest : CompileTimeNoRpcsBaseClassTest
|
||||
{
|
||||
[ServerRpc]
|
||||
public void SomeDummyServerRpc()
|
||||
@@ -25,7 +25,7 @@ namespace Unity.Netcode.RuntimeTests
|
||||
}
|
||||
}
|
||||
|
||||
public class GenericRpcTestNB<T> : NetworkBehaviour where T : unmanaged
|
||||
internal class GenericRpcTestNB<T> : NetworkBehaviour where T : unmanaged
|
||||
{
|
||||
public event Action<T, ServerRpcParams> OnServer_Rpc;
|
||||
|
||||
@@ -36,11 +36,11 @@ namespace Unity.Netcode.RuntimeTests
|
||||
}
|
||||
}
|
||||
|
||||
public class RpcTestNBFloat : GenericRpcTestNB<float>
|
||||
internal class RpcTestNBFloat : GenericRpcTestNB<float>
|
||||
{
|
||||
}
|
||||
|
||||
public class RpcTestNB : GenericRpcTestNB<ulong>
|
||||
internal class RpcTestNB : GenericRpcTestNB<ulong>
|
||||
{
|
||||
#if UNITY_NETCODE_NATIVE_COLLECTION_SUPPORT
|
||||
public event Action<NativeList<ulong>, ServerRpcParams> OnNativeListServer_Rpc;
|
||||
|
||||
@@ -14,14 +14,14 @@ using Vector4 = UnityEngine.Vector4;
|
||||
|
||||
namespace Unity.Netcode.RuntimeTests
|
||||
{
|
||||
public class RpcTypeSerializationTests : NetcodeIntegrationTest
|
||||
internal class RpcTypeSerializationTests : NetcodeIntegrationTest
|
||||
{
|
||||
public RpcTypeSerializationTests()
|
||||
{
|
||||
m_UseHost = false;
|
||||
}
|
||||
|
||||
public class RpcTestNB : NetworkBehaviour
|
||||
internal class RpcTestNB : NetworkBehaviour
|
||||
{
|
||||
public delegate void OnReceivedDelegate(object obj);
|
||||
public OnReceivedDelegate OnReceived;
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Unity.Netcode.RuntimeTests
|
||||
/// - Deserializing NetworkObjectReference to NetworkObject
|
||||
/// - Implicit operators of NetworkObjectReference
|
||||
/// </summary>
|
||||
public class NetworkBehaviourReferenceTests : IDisposable
|
||||
internal class NetworkBehaviourReferenceTests : IDisposable
|
||||
{
|
||||
private class TestNetworkBehaviour : NetworkBehaviour
|
||||
{
|
||||
@@ -156,7 +156,7 @@ namespace Unity.Netcode.RuntimeTests
|
||||
/// <summary>
|
||||
/// Integration tests for NetworkBehaviourReference
|
||||
/// </summary>
|
||||
public class NetworkBehaviourReferenceIntegrationTests : NetcodeIntegrationTest
|
||||
internal class NetworkBehaviourReferenceIntegrationTests : NetcodeIntegrationTest
|
||||
{
|
||||
protected override int NumberOfClients => 1;
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Unity.Netcode.RuntimeTests
|
||||
/// - Deserializing NetworkObjectReference to NetworkObject
|
||||
/// - Implicit operators of NetworkObjectReference
|
||||
/// </summary>
|
||||
public class NetworkObjectReferenceTests : IDisposable
|
||||
internal class NetworkObjectReferenceTests : IDisposable
|
||||
{
|
||||
private class TestNetworkBehaviour : NetworkBehaviour
|
||||
{
|
||||
@@ -340,7 +340,7 @@ namespace Unity.Netcode.RuntimeTests
|
||||
/// Helper method for tests to create and destroy Unity Objects.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of Object this context incorporates.</typeparam>
|
||||
public class UnityObjectContext<T> : UnityObjectContext where T : Object
|
||||
internal class UnityObjectContext<T> : UnityObjectContext where T : Object
|
||||
{
|
||||
private T m_Object;
|
||||
|
||||
@@ -353,7 +353,7 @@ namespace Unity.Netcode.RuntimeTests
|
||||
public T Object => m_Object;
|
||||
}
|
||||
|
||||
public class UnityObjectContext : IDisposable
|
||||
internal class UnityObjectContext : IDisposable
|
||||
{
|
||||
private Object m_Root;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ using UnityEngine;
|
||||
|
||||
namespace Unity.Netcode.RuntimeTests
|
||||
{
|
||||
public class StartStopTests
|
||||
internal class StartStopTests
|
||||
{
|
||||
private NetworkManager m_NetworkManager;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ using UnityEngine.TestTools;
|
||||
|
||||
namespace Unity.Netcode.RuntimeTests
|
||||
{
|
||||
public class StopStartRuntimeTests : NetcodeIntegrationTest
|
||||
internal class StopStartRuntimeTests : NetcodeIntegrationTest
|
||||
{
|
||||
protected override int NumberOfClients => 1;
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Unity.Netcode.RuntimeTests
|
||||
/// <summary>
|
||||
/// Runtime tests to test the network time system with the Unity player loop.
|
||||
/// </summary>
|
||||
public class NetworkTimeSystemTests
|
||||
internal class NetworkTimeSystemTests
|
||||
{
|
||||
private MonoBehaviourTest<PlayerLoopFixedTimeTestComponent> m_PlayerLoopFixedTimeTestComponent; // cache for teardown
|
||||
private MonoBehaviourTest<PlayerLoopTimeTestComponent> m_PlayerLoopTimeTestComponent; // cache for teardown
|
||||
@@ -117,7 +117,7 @@ namespace Unity.Netcode.RuntimeTests
|
||||
}
|
||||
}
|
||||
|
||||
public class PlayerLoopFixedTimeTestComponent : MonoBehaviour, IMonoBehaviourTest
|
||||
internal class PlayerLoopFixedTimeTestComponent : MonoBehaviour, IMonoBehaviourTest
|
||||
{
|
||||
public const int Passes = 100;
|
||||
|
||||
@@ -184,7 +184,7 @@ namespace Unity.Netcode.RuntimeTests
|
||||
public bool IsTestFinished => m_UpdatePasses >= Passes;
|
||||
}
|
||||
|
||||
public class PlayerLoopTimeTestComponent : MonoBehaviour, IMonoBehaviourTest
|
||||
internal class PlayerLoopTimeTestComponent : MonoBehaviour, IMonoBehaviourTest
|
||||
{
|
||||
public const int Passes = 100;
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace Unity.Netcode.RuntimeTests
|
||||
/// <summary>
|
||||
/// Tests that the time and tick system are initialized properly
|
||||
/// </summary>
|
||||
public class TimeInitializationTest
|
||||
internal class TimeInitializationTest
|
||||
{
|
||||
private int m_ClientTickCounter;
|
||||
private int m_ConnectedTick;
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace Unity.Netcode.RuntimeTests
|
||||
/// <summary>
|
||||
/// Tests the times of two clients connecting to a server using the SIPTransport (returns 50ms RTT but has no latency simulation)
|
||||
/// </summary>
|
||||
public class TimeIntegrationTest : NetcodeIntegrationTest
|
||||
internal class TimeIntegrationTest : NetcodeIntegrationTest
|
||||
{
|
||||
private const double k_AdditionalTimeTolerance = 0.3333d; // magic number and in theory not needed but without this mac os test fail in Yamato because it looks like we get random framerate drops during unit test.
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ using UnityEngine.TestTools;
|
||||
|
||||
namespace Unity.Netcode.RuntimeTests
|
||||
{
|
||||
public class TransformInterpolationObject : NetworkTransform
|
||||
internal class TransformInterpolationObject : NetworkTransform
|
||||
{
|
||||
public static bool TestComplete = false;
|
||||
// Set the minimum threshold which we will use as our margin of error
|
||||
@@ -63,9 +63,9 @@ namespace Unity.Netcode.RuntimeTests
|
||||
private const int k_MaxThresholdFailures = 4;
|
||||
private int m_ExceededThresholdCount;
|
||||
|
||||
protected override void Update()
|
||||
private void Update()
|
||||
{
|
||||
base.Update();
|
||||
base.OnUpdate();
|
||||
|
||||
if (!IsSpawned || TestComplete)
|
||||
{
|
||||
@@ -140,7 +140,7 @@ namespace Unity.Netcode.RuntimeTests
|
||||
}
|
||||
}
|
||||
|
||||
public class TransformInterpolationTests : NetcodeIntegrationTest
|
||||
internal class TransformInterpolationTests : NetcodeIntegrationTest
|
||||
{
|
||||
protected override int NumberOfClients => 1;
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ using static Unity.Netcode.RuntimeTests.UnityTransportTestHelpers;
|
||||
|
||||
namespace Unity.Netcode.RuntimeTests
|
||||
{
|
||||
public class UnityTransportConnectionTests
|
||||
internal class UnityTransportConnectionTests
|
||||
{
|
||||
// For tests using multiple clients.
|
||||
private const int k_NumClients = 5;
|
||||
@@ -208,7 +208,7 @@ namespace Unity.Netcode.RuntimeTests
|
||||
m_Clients[i].DisconnectLocalClient();
|
||||
}
|
||||
|
||||
yield return WaitForNetworkEvent(NetworkEvent.Disconnect, m_ServerEvents);
|
||||
yield return WaitForNetworkEvent(NetworkEvent.Disconnect, m_ServerEvents, 5);
|
||||
|
||||
// Check that we got the correct number of Disconnect events on the server.
|
||||
Assert.AreEqual(k_NumClients * 2, m_ServerEvents.Count);
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Unity.Netcode.RuntimeTests
|
||||
// The only reason it's defined as a MonoBehaviour is that OnDestroy is the only reliable way
|
||||
// to get the driver's Dispose method called from a UnityTest. Making it disposable would be
|
||||
// the preferred solution, but that doesn't always mesh well with coroutines.
|
||||
public class UnityTransportDriverClient : MonoBehaviour
|
||||
internal class UnityTransportDriverClient : MonoBehaviour
|
||||
{
|
||||
private NetworkDriver m_Driver;
|
||||
public NetworkDriver Driver => m_Driver;
|
||||
|
||||
@@ -8,7 +8,7 @@ using UnityEngine;
|
||||
|
||||
namespace Unity.Netcode.RuntimeTests
|
||||
{
|
||||
public static class UnityTransportTestHelpers
|
||||
internal static class UnityTransportTestHelpers
|
||||
{
|
||||
// Half a second might seem like a very long time to wait for a network event, but in CI
|
||||
// many of the machines are underpowered (e.g. old Android devices or Macs) and there are
|
||||
@@ -59,7 +59,7 @@ namespace Unity.Netcode.RuntimeTests
|
||||
|
||||
// Information about an event generated by a transport (basically just the parameters that
|
||||
// are normally passed along to a TransportEventDelegate).
|
||||
public struct TransportEvent
|
||||
internal struct TransportEvent
|
||||
{
|
||||
public NetworkEvent Type;
|
||||
public ulong ClientID;
|
||||
@@ -69,7 +69,7 @@ namespace Unity.Netcode.RuntimeTests
|
||||
// Utility class that logs events generated by a UnityTransport. Set it up by adding the
|
||||
// HandleEvent method as an OnTransportEvent delegate of the transport. The list of events
|
||||
// (in order in which they were generated) can be accessed through the Events property.
|
||||
public class TransportEventLogger
|
||||
internal class TransportEventLogger
|
||||
{
|
||||
private readonly List<TransportEvent> m_Events = new List<TransportEvent>();
|
||||
public List<TransportEvent> Events => m_Events;
|
||||
|
||||
@@ -12,7 +12,7 @@ using static Unity.Netcode.RuntimeTests.UnityTransportTestHelpers;
|
||||
|
||||
namespace Unity.Netcode.RuntimeTests
|
||||
{
|
||||
public class UnityTransportTests
|
||||
internal class UnityTransportTests
|
||||
{
|
||||
// No need to test all reliable delivery methods since they all map to the same pipeline.
|
||||
private static readonly NetworkDelivery[] k_DeliveryParameters =
|
||||
|
||||
@@ -19,7 +19,7 @@ using Random = System.Random;
|
||||
// I put them in their own namespace so they would be easier to navigate in the test list.
|
||||
namespace Unity.Netcode.RuntimeTests.UniversalRpcTests
|
||||
{
|
||||
public class UniversalRpcNetworkBehaviour : NetworkBehaviour
|
||||
internal class UniversalRpcNetworkBehaviour : NetworkBehaviour
|
||||
{
|
||||
public bool Stop = false;
|
||||
public string Received = string.Empty;
|
||||
@@ -534,7 +534,7 @@ namespace Unity.Netcode.RuntimeTests.UniversalRpcTests
|
||||
}
|
||||
}
|
||||
|
||||
public class UniversalRpcTestsBase : NetcodeIntegrationTest
|
||||
internal class UniversalRpcTestsBase : NetcodeIntegrationTest
|
||||
{
|
||||
protected override int NumberOfClients => 2;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user