docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class RelayNetworkOptions

    Represents Relay options.

    Inheritance
    object
    RelayNetworkOptions
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Unity.Services.Multiplayer
    Assembly: Unity.Services.Multiplayer.dll
    Syntax
    public class RelayNetworkOptions

    Constructors

    RelayNetworkOptions(RelayProtocol)

    Initializes a new instance of the RelayNetworkOptions struct from the specified parameters.

    Declaration
    public RelayNetworkOptions(RelayProtocol protocol)
    Parameters
    Type Name Description
    RelayProtocol protocol

    The selected RelayProtocol to be used for relay communication.

    Remarks

    To obtain the list of available region, use the Relay Allocations Service via ListRegionsAsync().
    To determine the lowest latency region, use GetSortedRelayQosResultsAsync(IList<string>).

    RelayNetworkOptions(RelayProtocol, string)

    Initializes a new instance of the RelayNetworkOptions struct from the specified parameters.

    Declaration
    public RelayNetworkOptions(RelayProtocol protocol, string region)
    Parameters
    Type Name Description
    RelayProtocol protocol

    The selected RelayProtocol to be used for relay communication.

    string region

    Force a specific Relay region to be used and skip auto-selection from QoS.

    Remarks

    To obtain the list of available region, use the Relay Allocations Service via ListRegionsAsync().
    To determine the lowest latency region, use GetSortedRelayQosResultsAsync(IList<string>).

    RelayNetworkOptions(RelayProtocol, string, bool)

    Initializes a new instance of the RelayNetworkOptions struct from the specified parameters.

    Declaration
    public RelayNetworkOptions(RelayProtocol protocol, string region, bool preserveRegion)
    Parameters
    Type Name Description
    RelayProtocol protocol

    The selected RelayProtocol to be used for relay communication.

    string region

    Force a specific Relay region to be used and skip auto-selection from QoS.

    bool preserveRegion

    Save the relay region to session properties and reuse it in case of host migration.

    Remarks

    To obtain the list of available region, use the Relay Allocations Service via ListRegionsAsync().
    To determine the lowest latency region, use GetSortedRelayQosResultsAsync(IList<string>).

    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

    Force a specific Relay region to be used and skip auto-selection from QoS.

    Declaration
    public string Region { get; }
    Property Value
    Type Description
    string
    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)