docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class ConnectionExtensions

    Provides extension methods on SessionOptions to configure connection options for sessions.

    Inheritance
    object
    ConnectionExtensions
    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 static class ConnectionExtensions

    Methods

    WithDirectConnection<T>(T, string, int?, string)

    The extension method configures the SessionOptions to create a direct connection when the session is created using provided IP and Port.

    Declaration
    public static T WithDirectConnection<T>(this T options, string ip = null, int? port = null, string listenAddress = null) where T : SessionOptions
    Parameters
    Type Name Description
    T options

    The SessionOptions this extension method applies to.

    string ip

    The IP address the netcode connection of the session will be connected to.

    int? port

    The port the netcode connection of the session will be connected to.

    string listenAddress

    As a host of a session, the address that will be used to listen to the incoming connection.

    Returns
    Type Description
    T

    SessionOptions

    Type Parameters
    Name Description
    T

    WithRelayConnection<T>(T, string)

    The extension method configures the SessionOptions to create a Relay connection within the provided region when the session is created.

    Declaration
    public static T WithRelayConnection<T>(this T options, string region = null) where T : SessionOptions
    Parameters
    Type Name Description
    T options

    The SessionOptions this extension method applies to.

    string region

    The Relay region where the Relay allocation will happen.

    Returns
    Type Description
    T

    SessionOptions

    Type Parameters
    Name Description
    T
    In This Article
    • Methods
      • WithDirectConnection<T>(T, string, int?, string)
      • WithRelayConnection<T>(T, string)
    Back to top
    Copyright © 2024 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)