Class RelayNetworkOptions
Represents Relay options specific to creating a new Relay server.
Inherited Members
Namespace: Unity.Services.Multiplayer
Assembly: Unity.Services.Multiplayer.dll
Syntax
public class RelayNetworkOptions
Constructors
RelayNetworkOptions(string, bool)
Creates a new RelayNetworkOptions instance with the given settings.
Declaration
public RelayNetworkOptions(string region = null, bool preserveRegion = false)
Parameters
| Type | Name | Description |
|---|---|---|
| string | region | The relay region to use. This skips auto-selection from QoS. |
| bool | preserveRegion | If |
Remarks
To get available regions, call ListRegionsAsync().
To find the lowest latency region, use GetSortedRelayQosResultsAsync(IList<string>).
RelayNetworkOptions(RelayProtocol)
Creates a new RelayNetworkOptions instance with the given settings.
Declaration
[Obsolete("The RelayProtocol value should be se through SessionOptions.WithNetworkOptions() API.")]
public RelayNetworkOptions(RelayProtocol protocol)
Parameters
| Type | Name | Description |
|---|---|---|
| RelayProtocol | protocol | The RelayProtocol to use for relay communication. If the protocol is not supported, the constructor uses Default and logs a warning. |
Remarks
If the protocol is not supported, the constructor uses Default and logs a warning.
RelayNetworkOptions(RelayProtocol, string)
Creates a new RelayNetworkOptions instance with the given settings.
Declaration
[Obsolete("The RelayProtocol value should be se through SessionOptions.WithNetworkOptions() API.")]
public RelayNetworkOptions(RelayProtocol protocol, string region)
Parameters
| Type | Name | Description |
|---|---|---|
| RelayProtocol | protocol | The RelayProtocol to use for relay communication. If the protocol is not supported, the constructor uses Default and logs a warning. |
| string | region | The relay region to use. This skips auto-selection from QoS. |
Remarks
To get available regions, call ListRegionsAsync().
To find the lowest latency region, use GetSortedRelayQosResultsAsync(IList<string>).
If the protocol is not supported, the constructor uses
Default and logs a warning.
RelayNetworkOptions(RelayProtocol, string, bool)
Creates a new RelayNetworkOptions instance with the given settings.
Declaration
[Obsolete("The RelayProtocol value should be set through SessionOptions.WithNetworkOptions() API.")]
public RelayNetworkOptions(RelayProtocol protocol, string region, bool preserveRegion)
Parameters
| Type | Name | Description |
|---|---|---|
| RelayProtocol | protocol | The RelayProtocol to use for relay communication. If the protocol is not supported, the constructor uses Default and logs a warning. |
| string | region | The relay region to use. This skips auto-selection from QoS. |
| bool | preserveRegion | If |
Remarks
To get available regions, call ListRegionsAsync().
To find the lowest latency region, use GetSortedRelayQosResultsAsync(IList<string>).
If the protocol is not supported, the constructor uses
Default and logs a warning.
Properties
Default
Gets the default RelayNetworkOptions.
Declaration
public static RelayNetworkOptions Default { get; }
Property Value
| Type | Description |
|---|---|
| RelayNetworkOptions |
PreserveRegion
Save the Relay region to session properties and reuse it in case of host migration.
Declaration
public bool PreserveRegion { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Protocol
The selected RelayProtocol to be used for relay communication.
Declaration
[Obsolete("This value was moved to the SessionOptions.WithNetworkOptions() API.")]
public RelayProtocol Protocol { get; }
Property Value
| Type | Description |
|---|---|
| RelayProtocol |
Remarks
This value is obsolete. Use WithNetworkOptions<T>(T, NetworkOptions) and RelayProtocol instead.
Region
Declaration
public string Region { get; }
Property Value
| Type | Description |
|---|---|
| string |