Class RelayNetworkOptions
Represents Relay options.
Inherited Members
Namespace: Unity.Services.Multiplayer
Assembly: Unity.Services.Multiplayer.dll
Syntax
public class RelayNetworkOptions
Constructors
RelayNetworkOptions(RelayProtocol)
Creates a new RelayNetworkOptions instance with the given settings.
Declaration
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
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
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 instance with Default.
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
public RelayProtocol Protocol { get; }
Property Value
Type | Description |
---|---|
RelayProtocol |
Region
Declaration
public string Region { get; }
Property Value
Type | Description |
---|---|
string |