Interface IHostSessionNetwork
A handle to the network handler used by the Host's Session.
Namespace: Unity.Services.Multiplayer
Assembly: Unity.Services.Multiplayer.dll
Syntax
public interface IHostSessionNetwork
Properties
NetworkHandler
A handler that configures the network as a session start and stops.
Declaration
INetworkHandler NetworkHandler { get; set; }
Property Value
| Type | Description |
|---|---|
| INetworkHandler |
State
State of the underlying network handler.
Declaration
NetworkState State { get; }
Property Value
| Type | Description |
|---|---|
| NetworkState |
Methods
StartDirectNetworkAsync(DirectNetworkOptions)
Starts the session associated network as a direct network using the provided options.
Declaration
Task StartDirectNetworkAsync(DirectNetworkOptions networkOptions)
Parameters
| Type | Name | Description |
|---|---|---|
| DirectNetworkOptions | networkOptions | The options used to configure the direct network, including port settings and other network parameters. |
Returns
| Type | Description |
|---|---|
| Task | A task that will be completed when the network is started. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when |
StartDistributedAuthorityNetworkAsync(RelayNetworkOptions)
Starts the session associated network as a distributed authority network.
Declaration
Task StartDistributedAuthorityNetworkAsync(RelayNetworkOptions networkOptions)
Parameters
| Type | Name | Description |
|---|---|---|
| RelayNetworkOptions | networkOptions | The options used to configure the relay network. |
Returns
| Type | Description |
|---|---|
| Task | A task that will be completed when the network is started. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when |
StartRelayNetworkAsync(RelayNetworkOptions)
Starts the session associated network as a relay network.
Declaration
Task StartRelayNetworkAsync(RelayNetworkOptions networkOptions)
Parameters
| Type | Name | Description |
|---|---|---|
| RelayNetworkOptions | networkOptions | The options used to configure the relay network. |
Returns
| Type | Description |
|---|---|
| Task | A task that will be completed when the network is started. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when |
StopNetworkAsync()
Stops the network.
Declaration
Task StopNetworkAsync()
Returns
| Type | Description |
|---|---|
| Task | A task that will be completed after the network has been shut down. |
Events
MigrationFailed
Raised when the operation to migrate the network fails
Declaration
event Action<SessionError> MigrationFailed
Event Type
| Type | Description |
|---|---|
| Action<SessionError> |
StartFailed
Raised when the operation to start the network fails
Declaration
event Action<SessionError> StartFailed
Event Type
| Type | Description |
|---|---|
| Action<SessionError> |
StateChanged
State changed events will be fired when the internal state changes.
Declaration
event Action<NetworkState> StateChanged
Event Type
| Type | Description |
|---|---|
| Action<NetworkState> |
StopFailed
Raised when the operation to stop the network fails
Declaration
event Action<SessionError> StopFailed
Event Type
| Type | Description |
|---|---|
| Action<SessionError> |