docs.unity3d.com
    Show / Hide Table of Contents

    Class SimulatorStageParameterExtensions

    Extensions for SimulatorUtility.Parameters.

    Inheritance
    Object
    SimulatorStageParameterExtensions
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: Unity.Networking.Transport.Utilities
    Syntax
    public static class SimulatorStageParameterExtensions

    Methods

    GetSimulatorStageParameters(ref NetworkSettings)

    Gets the SimulatorUtility.Parameters in the settings.

    Declaration
    public static SimulatorUtility.Parameters GetSimulatorStageParameters(this ref NetworkSettings settings)
    Parameters
    Type Name Description
    NetworkSettings settings

    Settings to get parameters from.

    Returns
    Type Description
    SimulatorUtility.Parameters

    Structure containing the simulator parameters.

    ModifySimulatorStageParameters(NetworkDriver, SimulatorUtility.Parameters)

    Modify the parameters of the simulator pipeline stage.

    Declaration
    public static void ModifySimulatorStageParameters(this NetworkDriver driver, SimulatorUtility.Parameters newParams)
    Parameters
    Type Name Description
    NetworkDriver driver

    Driver to modify.

    SimulatorUtility.Parameters newParams

    New parameters for the simulator stage.

    Remarks

    Some parameters (e.g. max packet count and size) are not modifiable. These need to be passed unmodified to this function (can't just leave them at 0). The current parameters can be obtained using CurrentSettings.

    WithSimulatorStageParameters(ref NetworkSettings, Int32, Int32, ApplyMode, Int32, Int32, Int32, Int32, Int32, Int32, Int32, UInt32)

    Sets the SimulatorUtility.Parameters in the settings.

    Declaration
    public static ref NetworkSettings WithSimulatorStageParameters(this ref NetworkSettings settings, int maxPacketCount, int maxPacketSize = 1400, ApplyMode mode = ApplyMode.AllPackets, int packetDelayMs = 0, int packetJitterMs = 0, int packetDropInterval = 0, int packetDropPercentage = 0, int packetDuplicationPercentage = 0, int fuzzFactor = 0, int fuzzOffset = 0, uint randomSeed = 0U)
    Parameters
    Type Name Description
    NetworkSettings settings

    Settings to modify.

    Int32 maxPacketCount

    The maximum amount of packets the pipeline can keep track of. This used when a packet is delayed, the packet is stored in the pipeline processing buffer and can be later brought back.

    Int32 maxPacketSize

    The maximum size of a packet which the simulator stores. If a packet exceeds this size it will bypass the simulator.

    ApplyMode mode

    Whether to apply simulation to received or sent packets (defaults to both).

    Int32 packetDelayMs

    Fixed delay in milliseconds to apply to all packets which pass through.

    Int32 packetJitterMs

    Variance of the delay that gets added to all packets that pass through. For example, setting this value to 5 will result in the delay being a random value within 5 milliseconds of the value set with PacketDelayMs.

    Int32 packetDropInterval

    Fixed interval to drop packets on. This is most suitable for tests where predictable behaviour is desired, as every X-th packet will be dropped. For example, if the value is 5 every fifth packet is dropped.

    Int32 packetDropPercentage

    Percentage of packets that will be dropped.

    Int32 packetDuplicationPercentage

    Percentage of packets that will be duplicated. Packets are duplicated at most once and will not be duplicated if they were first deemed to be dropped.

    Int32 fuzzFactor

    See FuzzFactor for details.

    Int32 fuzzOffset

    To be used along the fuzz factor. The offset is the offset inside the packet where fuzzing should start. Useful to avoid fuzzing headers for example.

    UInt32 randomSeed

    Value to use to seed the random number generator. For non-deterministic behavior, use a dynamic value here (e.g. the result of a call to Stopwatch.GetTimestamp).

    Returns
    Type Description
    NetworkSettings

    Settings structure with modified values.

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023