docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Interface IMultiplayerService

    Facade for session browsing, session management and matchmaking.

    Namespace: Unity.Services.Multiplayer
    Assembly: Unity.Services.Multiplayer.dll
    Syntax
    public interface IMultiplayerService

    Properties

    Sessions

    The list of active sessions

    Declaration
    IReadOnlyList<ISession> Sessions { get; }
    Property Value
    Type Description
    IReadOnlyList<ISession>

    Methods

    CreateOrJoinSessionAsync(string, CreateSessionOptions)

    Tries to join a Session, creates it if no Session associated to the provided ID exists.

    Declaration
    Task<ISession> CreateOrJoinSessionAsync(string sessionId, CreateSessionOptions createSessionOptions)
    Parameters
    Type Name Description
    string sessionId

    The Session ID.

    CreateSessionOptions createSessionOptions

    The options to create the Session.

    Returns
    Type Description
    Task<ISession>

    The created or joined Session.

    CreateSessionAsync(CreateSessionOptions)

    Creates a Session.

    Declaration
    Task<IHostSession> CreateSessionAsync(CreateSessionOptions options)
    Parameters
    Type Name Description
    CreateSessionOptions options

    The options for the Session creation.

    Returns
    Type Description
    Task<IHostSession>

    The created Session.

    JoinSessionByCodeAsync(string, JoinSessionOptions)

    Joins a Session through a join code.

    Declaration
    Task<ISession> JoinSessionByCodeAsync(string sessionCode, JoinSessionOptions options = null)
    Parameters
    Type Name Description
    string sessionCode

    The join code for the session.

    JoinSessionOptions options

    The options to join the Session.

    Returns
    Type Description
    Task<ISession>

    The joined Session.

    JoinSessionByIdAsync(string, JoinSessionOptions)

    Joins a Session by the session ID.

    Declaration
    Task<ISession> JoinSessionByIdAsync(string sessionId, JoinSessionOptions options = null)
    Parameters
    Type Name Description
    string sessionId

    The ID for the session.

    JoinSessionOptions options

    The options to join the Session.

    Returns
    Type Description
    Task<ISession>

    The joined Session.

    QuerySessionsAsync(QuerySessionsOptions)

    Query available sessions

    Declaration
    Task<QuerySessionsResults> QuerySessionsAsync(QuerySessionsOptions options)
    Parameters
    Type Name Description
    QuerySessionsOptions options

    The query options for the search

    Returns
    Type Description
    Task<QuerySessionsResults>

    QuickJoinSessionAsync(QuickJoinSessionOptions)

    Quick join a Session.

    Declaration
    Task<ISession> QuickJoinSessionAsync(QuickJoinSessionOptions options = null)
    Parameters
    Type Name Description
    QuickJoinSessionOptions options

    The quick join options

    Returns
    Type Description
    Task<ISession>

    The joined Session

    Events

    SessionAdded

    Raised when a new session is added

    Declaration
    event Action<ISession> SessionAdded
    Event Type
    Type Description
    Action<ISession>
    In This Article
    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)