Interface INetworkEventsApi
API that can be used to inspect the state of the simulated network and trigger events.
Namespace: Unity.Multiplayer.Tools.NetworkSimulator.Runtime
Syntax
public interface INetworkEventsApi
Properties
CurrentPreset
Returns the current connection preset used to simulate network conditions.
Declaration
INetworkSimulatorPreset CurrentPreset { get; }
Property Value
Type | Description |
---|---|
INetworkSimulatorPreset |
IsAvailable
Returns whether the Network Simulator fulfills all required dependencies and is available to be used.
Declaration
bool IsAvailable { get; }
Property Value
Type | Description |
---|---|
Boolean |
IsConnected
Returns true when Network Simulator is connected.
Declaration
bool IsConnected { get; }
Property Value
Type | Description |
---|---|
Boolean |
Methods
ChangeConnectionPreset(INetworkSimulatorPreset)
Changes the current connection preset used to simulate network condition parameters.
Declaration
void ChangeConnectionPreset(INetworkSimulatorPreset preset)
Parameters
Type | Name | Description |
---|---|---|
INetworkSimulatorPreset | preset | The Network Simulator Preset being set. |
Disconnect()
Simulates a network disconnection.
Declaration
void Disconnect()
Reconnect()
Reconnects after simulating a network disconnection.
Declaration
void Reconnect()
TriggerLagSpike(TimeSpan)
Simulates a lag spike for the specified duration.
Declaration
void TriggerLagSpike(TimeSpan duration)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | duration | The duration for which the lag spike shall last. |
TriggerLagSpikeAsync(TimeSpan)
Simulates a lag spike for the specified duration.
Declaration
Task TriggerLagSpikeAsync(TimeSpan duration)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | duration | The duration for which the lag spike shall last. |
Returns
Type | Description |
---|---|
Task | The task that runs for the duration of the lag spike. |