docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class IntegrationTestWithApproximation

    An extended NetcodeIntegrationTest class that includes various helper mehtods to handle aproximating float various in order to avoid floating point drift related errors.

    Inheritance
    object
    NetcodeIntegrationTest
    IntegrationTestWithApproximation
    Inherited Members
    NetcodeIntegrationTest.k_DefaultTimeoutPeriod
    NetcodeIntegrationTest.k_TickFrequency
    NetcodeIntegrationTest.s_GlobalTimeoutHelper
    NetcodeIntegrationTest.s_DefaultWaitForTick
    NetcodeIntegrationTest.NetcodeLogAssert
    NetcodeIntegrationTest.s_GlobalNetworkObjects
    NetcodeIntegrationTest.RegisterNetworkObject(NetworkObject)
    NetcodeIntegrationTest.DeregisterNetworkObject(NetworkObject)
    NetcodeIntegrationTest.DeregisterNetworkObject(ulong, ulong)
    NetcodeIntegrationTest.TotalClients
    NetcodeIntegrationTest.k_DefaultTickRate
    NetcodeIntegrationTest.NumberOfClients
    NetcodeIntegrationTest.m_CreateServerFirst
    NetcodeIntegrationTest.m_PlayerPrefab
    NetcodeIntegrationTest.m_ServerNetworkManager
    NetcodeIntegrationTest.m_ClientNetworkManagers
    NetcodeIntegrationTest.m_NetworkManagers
    NetcodeIntegrationTest.GetAuthorityNetworkManager()
    NetcodeIntegrationTest.GetNonAuthorityNetworkManager()
    NetcodeIntegrationTest.GetNonAuthorityNetworkManager(int)
    NetcodeIntegrationTest.m_PlayerNetworkObjects
    NetcodeIntegrationTest.m_UseHost
    NetcodeIntegrationTest.m_DistributedAuthority
    NetcodeIntegrationTest.m_NetworkTopologyType
    NetcodeIntegrationTest.m_UseCmbService
    NetcodeIntegrationTest.UseCMBService()
    NetcodeIntegrationTest.OnGetNetworkTopologyType()
    NetcodeIntegrationTest.SetDistributedAuthorityProperties(NetworkManager)
    NetcodeIntegrationTest.m_TargetFrameRate
    NetcodeIntegrationTest.m_EnableVerboseDebug
    NetcodeIntegrationTest.m_BypassConnectionTimeout
    NetcodeIntegrationTest.m_EnableTimeTravel
    NetcodeIntegrationTest.m_SetupIsACoroutine
    NetcodeIntegrationTest.m_TearDownIsACoroutine
    NetcodeIntegrationTest.VerboseDebug(string)
    NetcodeIntegrationTest.OnSetVerboseDebug()
    NetcodeIntegrationTest.OnSetIntegrationTestMode()
    NetcodeIntegrationTest.OnOneTimeSetup()
    NetcodeIntegrationTest.OneTimeSetup()
    NetcodeIntegrationTest.OnSetup()
    NetcodeIntegrationTest.OnInlineSetup()
    NetcodeIntegrationTest.SetUp()
    NetcodeIntegrationTest.OnCreatePlayerPrefab()
    NetcodeIntegrationTest.OnPlayerPrefabGameObjectCreated()
    NetcodeIntegrationTest.OnServerAndClientsCreated()
    NetcodeIntegrationTest.CreateServerAndClients()
    NetcodeIntegrationTest.CreateServerAndClients(int)
    NetcodeIntegrationTest.OnNewClientCreated(NetworkManager)
    NetcodeIntegrationTest.OnNewClientStarted(NetworkManager)
    NetcodeIntegrationTest.OnNewClientStartedAndConnected(NetworkManager)
    NetcodeIntegrationTest.ShouldWaitForNewClientToConnect(NetworkManager)
    NetcodeIntegrationTest.CreateNewClient()
    NetcodeIntegrationTest.CreateAndStartNewClient()
    NetcodeIntegrationTest.StartClient(NetworkManager)
    NetcodeIntegrationTest.CreateAndStartNewClientWithTimeTravel()
    NetcodeIntegrationTest.StopOneClient(NetworkManager, bool)
    NetcodeIntegrationTest.StopOneClientWithTimeTravel(NetworkManager, bool)
    NetcodeIntegrationTest.SetTimeTravelSimulatedLatency(float)
    NetcodeIntegrationTest.SetTimeTravelSimulatedDropRate(float)
    NetcodeIntegrationTest.SetTimeTravelSimulatedLatencyJitter(float)
    NetcodeIntegrationTest.CanStartServerAndClients()
    NetcodeIntegrationTest.OnStartedServerAndClients()
    NetcodeIntegrationTest.OnTimeTravelStartedServerAndClients()
    NetcodeIntegrationTest.OnServerAndClientsConnected()
    NetcodeIntegrationTest.OnTimeTravelServerAndClientsConnected()
    NetcodeIntegrationTest.ClientNetworkManagerPostStartInit()
    NetcodeIntegrationTest.LogAllMessages
    NetcodeIntegrationTest.ShouldCheckForSpawnedPlayers()
    NetcodeIntegrationTest.StartServerAndClients()
    NetcodeIntegrationTest.StartServerAndClientsWithTimeTravel()
    NetcodeIntegrationTest.CanClientsLoad()
    NetcodeIntegrationTest.CanClientsUnload()
    NetcodeIntegrationTest.DeRegisterSceneManagerHandler()
    NetcodeIntegrationTest.RegisterSceneManagerHandler()
    NetcodeIntegrationTest.OnCanSceneCleanUpUnload(Scene)
    NetcodeIntegrationTest.ShutdownAndCleanUp()
    NetcodeIntegrationTest.CoroutineShutdownAndCleanUp()
    NetcodeIntegrationTest.OnTearDown()
    NetcodeIntegrationTest.OnInlineTearDown()
    NetcodeIntegrationTest.TearDown()
    NetcodeIntegrationTest.OnOneTimeTearDown()
    NetcodeIntegrationTest.OneTimeTearDown()
    NetcodeIntegrationTest.CanDestroyNetworkObject(NetworkObject)
    NetcodeIntegrationTest.DestroySceneNetworkObjects()
    NetcodeIntegrationTest.EnableMessageLogging()
    NetcodeIntegrationTest.WaitForConditionOrTimeOut(Func<bool>, TimeoutHelper)
    NetcodeIntegrationTest.WaitForConditionOrTimeOutWithTimeTravel(Func<bool>, int)
    NetcodeIntegrationTest.WaitForConditionOrTimeOut(IConditionalPredicate, TimeoutHelper)
    NetcodeIntegrationTest.WaitForConditionOrTimeOutWithTimeTravel(IConditionalPredicate, int)
    NetcodeIntegrationTest.WaitForConditionOrTimeOut(Func<StringBuilder, bool>, TimeoutHelper)
    NetcodeIntegrationTest.WaitForClientsConnectedOrTimeOut(NetworkManager[])
    NetcodeIntegrationTest.WaitForClientsConnectedOrTimeOutWithTimeTravel(NetworkManager[])
    NetcodeIntegrationTest.WaitForClientsConnectedOrTimeOut()
    NetcodeIntegrationTest.WaitForClientsConnectedOrTimeOutWithTimeTravel()
    NetcodeIntegrationTest.CreateNetworkObjectPrefab(string)
    NetcodeIntegrationTest.SpawnObject(GameObject, NetworkManager, bool)
    NetcodeIntegrationTest.SpawnPlayerObject(GameObject, NetworkManager, bool)
    NetcodeIntegrationTest.SpawnObjects(GameObject, NetworkManager, int, bool)
    NetcodeIntegrationTest.AssertOnTimeout(string, TimeoutHelper)
    NetcodeIntegrationTest.WaitForTicks(NetworkManager, int)
    NetcodeIntegrationTest.TimeTravel(double, int)
    NetcodeIntegrationTest.GetTickRate()
    NetcodeIntegrationTest.GetFrameRate()
    NetcodeIntegrationTest.ConfigureFramesPerTick()
    NetcodeIntegrationTest.TimeTravelAdvanceTick()
    NetcodeIntegrationTest.TimeTravelToNextTick()
    NetcodeIntegrationTest.SimulateOneFrame()
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Unity.Netcode.TestHelpers.Runtime
    Assembly: Unity.Netcode.Runtime.Tests.dll
    Syntax
    public abstract class IntegrationTestWithApproximation : NetcodeIntegrationTest

    Constructors

    IntegrationTestWithApproximation()

    Default constructor with no parameters.

    Declaration
    public IntegrationTestWithApproximation()

    IntegrationTestWithApproximation(NetworkTopologyTypes)

    Overloaded constructor accepting the NetworkTopologyTypes as a parameter.

    Declaration
    public IntegrationTestWithApproximation(NetworkTopologyTypes networkTopologyType)
    Parameters
    Type Name Description
    NetworkTopologyTypes networkTopologyType

    The NetworkTopologyTypes to use for the NUnit.Framework.TestFixtureAttribute pass.

    Remarks

    This is useful when using the NUnit.Framework.TestFixtureAttribute with your integration test.

    IntegrationTestWithApproximation(NetworkTopologyTypes, HostOrServer)

    Overloaded constructor accepting the NetworkTopologyTypes and NetcodeIntegrationTest.HostOrServer as parameters.

    Declaration
    public IntegrationTestWithApproximation(NetworkTopologyTypes networkTopologyType, NetcodeIntegrationTest.HostOrServer hostOrServer)
    Parameters
    Type Name Description
    NetworkTopologyTypes networkTopologyType

    The NetworkTopologyTypes to use for the NUnit.Framework.TestFixtureAttribute pass.

    NetcodeIntegrationTest.HostOrServer hostOrServer

    The NetcodeIntegrationTest.HostOrServer to use for the NUnit.Framework.TestFixtureAttribute pass.

    Remarks

    This is useful when using the NUnit.Framework.TestFixtureAttribute with your integration test.

    IntegrationTestWithApproximation(HostOrServer)

    Overloaded constructor accepting the NetcodeIntegrationTest.HostOrServer as a parameter.

    Declaration
    public IntegrationTestWithApproximation(NetcodeIntegrationTest.HostOrServer hostOrServer)
    Parameters
    Type Name Description
    NetcodeIntegrationTest.HostOrServer hostOrServer

    The NetcodeIntegrationTest.HostOrServer to use for the NUnit.Framework.TestFixtureAttribute pass.

    Remarks

    This is useful when using the NUnit.Framework.TestFixtureAttribute with your integration test.

    Methods

    Approximately(float, float)

    Determines an aproximated comparison between two float values.

    Declaration
    protected bool Approximately(float a, float b)
    Parameters
    Type Name Description
    float a

    The first float value.

    float b

    The second float value.

    Returns
    Type Description
    bool

    Returns true if they are approximately the same and false if they are not.

    Approximately(Quaternion, Quaternion)

    Determines an aproximated comparison between two Quaternion values.

    Declaration
    protected bool Approximately(Quaternion a, Quaternion b)
    Parameters
    Type Name Description
    Quaternion a

    The first Quaternion value.

    Quaternion b

    The second Quaternion value.

    Returns
    Type Description
    bool

    Returns true if they are approximately the same and false if they are not.

    Approximately(Vector2, Vector2)

    Determines an aproximated comparison between two Vector2 values.

    Declaration
    protected bool Approximately(Vector2 a, Vector2 b)
    Parameters
    Type Name Description
    Vector2 a

    The first Vector2 value.

    Vector2 b

    The second Vector2 value.

    Returns
    Type Description
    bool

    Returns true if they are approximately the same and false if they are not.

    Approximately(Vector3, Vector3)

    Determines an aproximated comparison between two Vector3 values.

    Declaration
    protected bool Approximately(Vector3 a, Vector3 b)
    Parameters
    Type Name Description
    Vector3 a

    The first Vector3 value.

    Vector3 b

    The second Vector3 value.

    Returns
    Type Description
    bool

    Returns true if they are approximately the same and false if they are not.

    ApproximatelyEuler(float, float)

    Determines an aproximated comparison between two Euler values.

    Declaration
    protected bool ApproximatelyEuler(float a, float b)
    Parameters
    Type Name Description
    float a

    The first Euler value.

    float b

    The second Euler value.

    Returns
    Type Description
    bool

    Returns true if they are approximately the same and false if they are not.

    ApproximatelyEuler(Vector3, Vector3)

    Determines an aproximated comparison between two Vector3 expressed in Euler values.

    Declaration
    protected bool ApproximatelyEuler(Vector3 a, Vector3 b)
    Parameters
    Type Name Description
    Vector3 a

    The first Vector3 expressed in Euler values.

    Vector3 b

    The second Vector3 expressed in Euler values.

    Returns
    Type Description
    bool

    Returns true if they are approximately the same and false if they are not.

    EulerDelta(float, float)

    Returns the delta between two Euler angles.

    Declaration
    protected float EulerDelta(float a, float b)
    Parameters
    Type Name Description
    float a

    The first Euler value.

    float b

    The second Euler value.

    Returns
    Type Description
    float

    A float delta between the two float values.

    EulerDelta(Vector3, Vector3)

    Returns the delta between two Vector3 values that represent Euler angles.

    Declaration
    protected Vector3 EulerDelta(Vector3 a, Vector3 b)
    Parameters
    Type Name Description
    Vector3 a

    The first Euler Vector3 value.

    Vector3 b

    The second Euler Vector3 value.

    Returns
    Type Description
    Vector3

    A Vector3 delta between the two Vector3 values.

    GetDeltaVarianceThreshold()

    Override this to make changes to the precision level used.

    Declaration
    protected virtual float GetDeltaVarianceThreshold()
    Returns
    Type Description
    float

    A float value representing the minimum tolerence value required to be considered an approximation of a float value comparison.

    GetRandomVector3(float, float)

    Returns a randomly generated Vector3 based on the min and max range specified in the parameters.

    Declaration
    protected Vector3 GetRandomVector3(float min, float max)
    Parameters
    Type Name Description
    float min

    The minimum float value.

    float max

    The maximum float value.

    Returns
    Type Description
    Vector3

    The randomly generated Vector3 result.

    Remarks

    Each axis value is a randomly generated value between min and max.

    GetVector3Values(Vector3)

    Returns a six decimal place string to represent a Vector3 value.

    Declaration
    protected string GetVector3Values(Vector3 vector3)
    Parameters
    Type Name Description
    Vector3 vector3

    The Vector3 value to convert to a string.

    Returns
    Type Description
    string

    string representing the Vector3 passed in.

    GetVector3Values(ref Vector3)

    Returns a six decimal place string to represent a Vector3 value.

    Declaration
    protected string GetVector3Values(ref Vector3 vector3)
    Parameters
    Type Name Description
    Vector3 vector3

    A reference to the Vector3 value to convert to a string.

    Returns
    Type Description
    string

    string representing the Vector3 passed in.

    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)