docs.unity3d.com
    Show / Hide Table of Contents

    Class NetworkTransformTests

    Integration tests for NetworkTransform that will test both server and host operating modes and will test both authoritative models for each operating mode.

    Inheritance
    Object
    NetcodeIntegrationTest
    IntegrationTestWithApproximation
    NetworkTransformTests
    Inherited Members
    IntegrationTestWithApproximation.EulerDelta(Single, Single)
    IntegrationTestWithApproximation.EulerDelta(Vector3, Vector3)
    IntegrationTestWithApproximation.ApproximatelyEuler(Single, Single)
    IntegrationTestWithApproximation.Approximately(Single, Single)
    IntegrationTestWithApproximation.Approximately(Vector2, Vector2)
    IntegrationTestWithApproximation.Approximately(Vector3, Vector3)
    IntegrationTestWithApproximation.Approximately(Quaternion, Quaternion)
    IntegrationTestWithApproximation.ApproximatelyEuler(Vector3, Vector3)
    IntegrationTestWithApproximation.GetRandomVector3(Single, Single)
    NetcodeIntegrationTest.s_GlobalTimeoutHelper
    NetcodeIntegrationTest.s_DefaultWaitForTick
    NetcodeIntegrationTest.NetcodeLogAssert
    NetcodeIntegrationTest.s_GlobalNetworkObjects
    NetcodeIntegrationTest.RegisterNetworkObject(NetworkObject)
    NetcodeIntegrationTest.DeregisterNetworkObject(NetworkObject)
    NetcodeIntegrationTest.DeregisterNetworkObject(UInt64, UInt64)
    NetcodeIntegrationTest.TotalClients
    NetcodeIntegrationTest.k_DefaultTickRate
    NetcodeIntegrationTest.m_CreateServerFirst
    NetcodeIntegrationTest.m_PlayerPrefab
    NetcodeIntegrationTest.m_ServerNetworkManager
    NetcodeIntegrationTest.m_ClientNetworkManagers
    NetcodeIntegrationTest.m_PlayerNetworkObjects
    NetcodeIntegrationTest.m_UseHost
    NetcodeIntegrationTest.m_TargetFrameRate
    NetcodeIntegrationTest.m_EnableVerboseDebug
    NetcodeIntegrationTest.m_BypassConnectionTimeout
    NetcodeIntegrationTest.VerboseDebug(String)
    NetcodeIntegrationTest.OnSetVerboseDebug()
    NetcodeIntegrationTest.OnSetIntegrationTestMode()
    NetcodeIntegrationTest.OneTimeSetup()
    NetcodeIntegrationTest.OnSetup()
    NetcodeIntegrationTest.SetUp()
    NetcodeIntegrationTest.OnPlayerPrefabGameObjectCreated()
    NetcodeIntegrationTest.CreateServerAndClients()
    NetcodeIntegrationTest.OnNewClientStarted(NetworkManager)
    NetcodeIntegrationTest.OnNewClientStartedAndConnected(NetworkManager)
    NetcodeIntegrationTest.CreateAndStartNewClient()
    NetcodeIntegrationTest.CreateAndStartNewClientWithTimeTravel()
    NetcodeIntegrationTest.StopOneClient(NetworkManager, Boolean)
    NetcodeIntegrationTest.StopOneClientWithTimeTravel(NetworkManager, Boolean)
    NetcodeIntegrationTest.CreateServerAndClients(Int32)
    NetcodeIntegrationTest.CanStartServerAndClients()
    NetcodeIntegrationTest.OnStartedServerAndClients()
    NetcodeIntegrationTest.OnTimeTravelStartedServerAndClients()
    NetcodeIntegrationTest.OnServerAndClientsConnected()
    NetcodeIntegrationTest.ClientNetworkManagerPostStartInit()
    NetcodeIntegrationTest.LogAllMessages
    NetcodeIntegrationTest.StartServerAndClients()
    NetcodeIntegrationTest.StartServerAndClientsWithTimeTravel()
    NetcodeIntegrationTest.CanClientsLoad()
    NetcodeIntegrationTest.CanClientsUnload()
    NetcodeIntegrationTest.DeRegisterSceneManagerHandler()
    NetcodeIntegrationTest.RegisterSceneManagerHandler()
    NetcodeIntegrationTest.OnCanSceneCleanUpUnload(Scene)
    NetcodeIntegrationTest.ShutdownAndCleanUp()
    NetcodeIntegrationTest.OnTearDown()
    NetcodeIntegrationTest.TearDown()
    NetcodeIntegrationTest.OneTimeTearDown()
    NetcodeIntegrationTest.CanDestroyNetworkObject(NetworkObject)
    NetcodeIntegrationTest.DestroySceneNetworkObjects()
    NetcodeIntegrationTest.EnableMessageLogging()
    NetcodeIntegrationTest.WaitForConditionOrTimeOut(Func<Boolean>, TimeoutHelper)
    NetcodeIntegrationTest.WaitForConditionOrTimeOutWithTimeTravel(Func<Boolean>, Int32)
    NetcodeIntegrationTest.WaitForConditionOrTimeOut(IConditionalPredicate, TimeoutHelper)
    NetcodeIntegrationTest.WaitForConditionOrTimeOutWithTimeTravel(IConditionalPredicate, Int32)
    NetcodeIntegrationTest.WaitForClientsConnectedOrTimeOut(NetworkManager[])
    NetcodeIntegrationTest.WaitForClientsConnectedOrTimeOutWithTimeTravel(NetworkManager[])
    NetcodeIntegrationTest.WaitForClientsConnectedOrTimeOut()
    NetcodeIntegrationTest.WaitForClientsConnectedOrTimeOutWithTimeTravel()
    NetcodeIntegrationTest.CreateNetworkObjectPrefab(String)
    NetcodeIntegrationTest.SpawnObject(GameObject, NetworkManager, Boolean)
    NetcodeIntegrationTest.SpawnObjects(GameObject, NetworkManager, Int32, Boolean)
    NetcodeIntegrationTest.AssertOnTimeout(String, TimeoutHelper)
    NetcodeIntegrationTest.WaitForTicks(NetworkManager, Int32)
    NetcodeIntegrationTest.TimeTravel(Double, Int32)
    NetcodeIntegrationTest.TimeTravelToNextTick()
    NetcodeIntegrationTest.SimulateOneFrame()
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: Unity.Netcode.RuntimeTests
    Syntax
    public class NetworkTransformTests : IntegrationTestWithApproximation

    Constructors

    NetworkTransformTests(NetcodeIntegrationTest.HostOrServer, NetworkTransformTests.Authority)

    Constructor

    Declaration
    public NetworkTransformTests(NetcodeIntegrationTest.HostOrServer testWithHost, NetworkTransformTests.Authority authority)
    Parameters
    Type Name Description
    NetcodeIntegrationTest.HostOrServer testWithHost

    Determines if we are running as a server or host

    NetworkTransformTests.Authority authority

    Determines if we are using server or owner authority

    Properties

    m_EnableTimeTravel

    Declaration
    protected override bool m_EnableTimeTravel { get; }
    Property Value
    Type Description
    Boolean
    Overrides
    NetcodeIntegrationTest.m_EnableTimeTravel

    m_SetupIsACoroutine

    Declaration
    protected override bool m_SetupIsACoroutine { get; }
    Property Value
    Type Description
    Boolean
    Overrides
    NetcodeIntegrationTest.m_SetupIsACoroutine

    m_TearDownIsACoroutine

    Declaration
    protected override bool m_TearDownIsACoroutine { get; }
    Property Value
    Type Description
    Boolean
    Overrides
    NetcodeIntegrationTest.m_TearDownIsACoroutine

    NumberOfClients

    Declaration
    protected override int NumberOfClients { get; }
    Property Value
    Type Description
    Int32
    Overrides
    NetcodeIntegrationTest.NumberOfClients

    Methods

    GetDeltaVarianceThreshold()

    Declaration
    protected override float GetDeltaVarianceThreshold()
    Returns
    Type Description
    Single
    Overrides
    IntegrationTestWithApproximation.GetDeltaVarianceThreshold()

    LateJoiningPlayerInitialScaleValues(NetworkTransformTests.TransformSpace, NetworkTransformTests.Interpolation, NetworkTransformTests.OverrideState)

    Checks scale of a late joining client for all instances of the late joining client's player

    Declaration
    public void LateJoiningPlayerInitialScaleValues(NetworkTransformTests.TransformSpace testLocalTransform, NetworkTransformTests.Interpolation interpolation, NetworkTransformTests.OverrideState overideState)
    Parameters
    Type Name Description
    NetworkTransformTests.TransformSpace testLocalTransform
    NetworkTransformTests.Interpolation interpolation
    NetworkTransformTests.OverrideState overideState

    NetworkTransformMultipleChangesOverTime(NetworkTransformTests.TransformSpace, NetworkTransformTests.OverrideState, NetworkTransformTests.Precision, NetworkTransformTests.Rotation, NetworkTransformTests.Axis)

    This validates that multiple changes can occur within the same tick or over several ticks while still keeping non-authoritative instances synchronized.

    Declaration
    public void NetworkTransformMultipleChangesOverTime(NetworkTransformTests.TransformSpace testLocalTransform, NetworkTransformTests.OverrideState overideState, NetworkTransformTests.Precision precision, NetworkTransformTests.Rotation rotationSynch, NetworkTransformTests.Axis axis)
    Parameters
    Type Name Description
    NetworkTransformTests.TransformSpace testLocalTransform
    NetworkTransformTests.OverrideState overideState
    NetworkTransformTests.Precision precision
    NetworkTransformTests.Rotation rotationSynch
    NetworkTransformTests.Axis axis

    NetworkTransformParentedLocalSpaceTest(NetworkTransformTests.Interpolation)

    Validates that local space transform values remain the same when a NetworkTransform is parented under another NetworkTransform

    Declaration
    public void NetworkTransformParentedLocalSpaceTest(NetworkTransformTests.Interpolation interpolation)
    Parameters
    Type Name Description
    NetworkTransformTests.Interpolation interpolation

    NonAuthorityOwnerSettingStateTest(NetworkTransformTests.Interpolation)

    This test validates the SetState(Nullable<Vector3>, Nullable<Quaternion>, Nullable<Vector3>, Boolean) method usage for the non-authoritative side. It will either be the owner or the server making/requesting state changes. This validates that:

    • The owner authoritative mode can still be controlled by the server (i.e. owner authoritative with server authority override capabilities)
    • The server authoritative mode can still be directed by the client owner.
    Declaration
    public void NonAuthorityOwnerSettingStateTest(NetworkTransformTests.Interpolation interpolation)
    Parameters
    Type Name Description
    NetworkTransformTests.Interpolation interpolation
    Remarks

    This also tests that the original server authoritative model with client-owner driven NetworkTransforms is preserved.

    OnCreatePlayerPrefab()

    Declaration
    protected override void OnCreatePlayerPrefab()
    Overrides
    NetcodeIntegrationTest.OnCreatePlayerPrefab()

    OnInlineSetup()

    Declaration
    protected override void OnInlineSetup()
    Overrides
    NetcodeIntegrationTest.OnInlineSetup()

    OnInlineTearDown()

    Declaration
    protected override void OnInlineTearDown()
    Overrides
    NetcodeIntegrationTest.OnInlineTearDown()

    OnNewClientCreated(NetworkManager)

    Declaration
    protected override void OnNewClientCreated(NetworkManager networkManager)
    Parameters
    Type Name Description
    NetworkManager networkManager
    Overrides
    NetcodeIntegrationTest.OnNewClientCreated(NetworkManager)

    OnOneTimeSetup()

    Declaration
    protected override void OnOneTimeSetup()
    Overrides
    NetcodeIntegrationTest.OnOneTimeSetup()

    OnOneTimeTearDown()

    Declaration
    protected override void OnOneTimeTearDown()
    Overrides
    NetcodeIntegrationTest.OnOneTimeTearDown()

    OnServerAndClientsCreated()

    Declaration
    protected override void OnServerAndClientsCreated()
    Overrides
    NetcodeIntegrationTest.OnServerAndClientsCreated()

    OnTimeTravelServerAndClientsConnected()

    Declaration
    protected override void OnTimeTravelServerAndClientsConnected()
    Overrides
    NetcodeIntegrationTest.OnTimeTravelServerAndClientsConnected()

    TeleportTest(NetworkTransformTests.Interpolation, NetworkTransformTests.Precision)

    The tests teleporting with and without interpolation

    Declaration
    public void TeleportTest(NetworkTransformTests.Interpolation interpolation, NetworkTransformTests.Precision precision)
    Parameters
    Type Name Description
    NetworkTransformTests.Interpolation interpolation
    NetworkTransformTests.Precision precision

    TestAuthoritativeTransformChangeOneAtATime(NetworkTransformTests.TransformSpace, NetworkTransformTests.Interpolation, NetworkTransformTests.OverrideState)

    Tests changing all axial values one at a time. These tests are performed:

    • While in local space and world space
    • While interpolation is enabled and disabled
    • Using the TryCommitTransformToServer "override" that can be used from a child derived or external class.
    Declaration
    public void TestAuthoritativeTransformChangeOneAtATime(NetworkTransformTests.TransformSpace testLocalTransform, NetworkTransformTests.Interpolation interpolation, NetworkTransformTests.OverrideState overideState)
    Parameters
    Type Name Description
    NetworkTransformTests.TransformSpace testLocalTransform
    NetworkTransformTests.Interpolation interpolation
    NetworkTransformTests.OverrideState overideState

    TestBitsetValue(NetworkTransformTests.Interpolation)

    Test to make sure that the bitset value is updated properly

    Declaration
    public void TestBitsetValue(NetworkTransformTests.Interpolation interpolation)
    Parameters
    Type Name Description
    NetworkTransformTests.Interpolation interpolation

    TestRotationThresholdDeltaCheck(NetworkTransformTests.Interpolation, NetworkTransformTests.Precision)

    Validates that rotation checks don't produce false positive results when rolling over between 0 and 360 degrees

    Declaration
    public void TestRotationThresholdDeltaCheck(NetworkTransformTests.Interpolation interpolation, NetworkTransformTests.Precision precision)
    Parameters
    Type Name Description
    NetworkTransformTests.Interpolation interpolation
    NetworkTransformTests.Precision precision

    VerifyNonAuthorityCantChangeTransform(NetworkTransformTests.Interpolation, NetworkTransformTests.Precision)

    Test to verify nonAuthority cannot change the transform directly

    Declaration
    public void VerifyNonAuthorityCantChangeTransform(NetworkTransformTests.Interpolation interpolation, NetworkTransformTests.Precision precision)
    Parameters
    Type Name Description
    NetworkTransformTests.Interpolation interpolation
    NetworkTransformTests.Precision precision
    Back to top Copyright © 2023 Unity Technologies — Terms of use
    Generated by DocFX
    on 26 October 2023