Class SimulatorStageParameterExtensions
Extensions for SimulatorUtility.Parameters.
Inherited Members
Namespace: Unity.Networking.Transport.Utilities
Assembly: Unity.Networking.Transport.dll
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, 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, int, int, ApplyMode, int, int, int, int, int, int, int, uint)
Sets the SimulatorUtility.Parameters in the settings.
Declaration
public static ref NetworkSettings WithSimulatorStageParameters(this ref NetworkSettings settings, int maxPacketCount, int maxPacketSize = 1472, 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 = 0)
Parameters
Type | Name | Description |
---|---|---|
NetworkSettings | settings | Settings to modify. |
int | 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. |
int | 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). |
int | packetDelayMs | Fixed delay in milliseconds to apply to all packets which pass through. |
int | 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 |
int | 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. |
int | packetDropPercentage | Percentage of packets that will be dropped. |
int | 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. |
int | fuzzFactor | See FuzzFactor for details. |
int | 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. |
uint | 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 |
Returns
Type | Description |
---|---|
NetworkSettings | Settings structure with modified values. |