docs.unity3d.com
    Show / Hide Table of Contents

    Interface ILobbyService

    Service for Lobbies. Provides user the ability to create, delete, update, and query Lobbies. Includes operations for interacting with given players in a Lobby context.

    Namespace: Unity.Services.Lobbies
    Syntax
    public interface ILobbyService

    Methods

    CreateLobbyAsync(String, Int32, CreateLobbyOptions)

    Create a Lobby with a given name and specified player limit. Async operation.

    Declaration
    Task<Lobby> CreateLobbyAsync(string lobbyName, int maxPlayers, CreateLobbyOptions options = null)
    Parameters
    Type Name Description
    String lobbyName

    Name of new lobby

    Int32 maxPlayers

    Player limit

    CreateLobbyOptions options

    Optional request parameters

    Returns
    Type Description
    Task<Lobby>

    Lobby data for the lobby that was just created

    Exceptions
    Type Condition
    ArgumentNullException
    InvalidOperationException
    LobbyServiceException

    DeleteLobbyAsync(String)

    Delete a Lobby by specifying a Lobby ID. Async operation.

    Declaration
    Task DeleteLobbyAsync(string lobbyId)
    Parameters
    Type Name Description
    String lobbyId

    ID of the Lobby to delete

    Returns
    Type Description
    Task

    Awaitable task

    Exceptions
    Type Condition
    ArgumentNullException
    LobbyServiceException

    GetJoinedLobbiesAsync()

    Async Operation. Get currently joined lobbies.

    Declaration
    Task<List<string>> GetJoinedLobbiesAsync()
    Returns
    Type Description
    Task<List<String>>

    List of lobbies the active player has joined

    Exceptions
    Type Condition
    LobbyServiceException

    GetLobbyAsync(String)

    Retrieve data for a Lobby by specifying a Lobby ID. Async operation.

    Declaration
    Task<Lobby> GetLobbyAsync(string lobbyId)
    Parameters
    Type Name Description
    String lobbyId

    ID of the Lobby to retrieve

    Returns
    Type Description
    Task<Lobby>

    Lobby data

    Exceptions
    Type Condition
    ArgumentNullException
    LobbyServiceException

    JoinLobbyByCodeAsync(String, JoinLobbyByCodeOptions)

    Join a Lobby using a given Lobby Invite Code. Async operation.

    Declaration
    Task<Lobby> JoinLobbyByCodeAsync(string lobbyCode, JoinLobbyByCodeOptions options = null)
    Parameters
    Type Name Description
    String lobbyCode

    Invite Code for target lobby.

    JoinLobbyByCodeOptions options

    Optional request parameters

    Returns
    Type Description
    Task<Lobby>

    Lobby data for the lobby joined

    Exceptions
    Type Condition
    ArgumentNullException
    LobbyServiceException

    JoinLobbyByIdAsync(String, JoinLobbyByIdOptions)

    Join a Lobby by specifying the Lobby ID. Async operation.

    Declaration
    Task<Lobby> JoinLobbyByIdAsync(string lobbyId, JoinLobbyByIdOptions options = null)
    Parameters
    Type Name Description
    String lobbyId

    ID of the Lobby to join

    JoinLobbyByIdOptions options

    Optional request parameters

    Returns
    Type Description
    Task<Lobby>

    Lobby data for the lobby joined

    Exceptions
    Type Condition
    ArgumentNullException
    LobbyServiceException

    QueryLobbiesAsync(QueryLobbiesOptions)

    Query and retrieve a list of lobbies that meet specified query parameters. Async operation.

    Declaration
    Task<QueryResponse> QueryLobbiesAsync(QueryLobbiesOptions options = null)
    Parameters
    Type Name Description
    QueryLobbiesOptions options

    Query parameters

    Returns
    Type Description
    Task<QueryResponse>

    Query response that includes list of Lobbies meeting specified parameters

    Exceptions
    Type Condition
    LobbyServiceException

    QuickJoinLobbyAsync(QuickJoinLobbyOptions)

    Query available lobbies and join a randomly selected instance. Async operation.

    Declaration
    Task<Lobby> QuickJoinLobbyAsync(QuickJoinLobbyOptions options = null)
    Parameters
    Type Name Description
    QuickJoinLobbyOptions options

    Optional parameters (includes queryable arguments)

    Returns
    Type Description
    Task<Lobby>

    Lobby data for the lobby joined

    Exceptions
    Type Condition
    LobbyServiceException

    ReconnectToLobbyAsync(String)

    Reconnects to the lobby.

    Declaration
    Task<Lobby> ReconnectToLobbyAsync(string lobbyId)
    Parameters
    Type Name Description
    String lobbyId

    The ID of the lobby to reconnect to.

    Returns
    Type Description
    Task<Lobby>

    The lobby you reconnected to.

    RemovePlayerAsync(String, String)

    Remove a player from a specified Lobby. Async operation.

    Declaration
    Task RemovePlayerAsync(string lobbyId, string playerId)
    Parameters
    Type Name Description
    String lobbyId

    Target Lobby ID to remove player from

    String playerId

    Player ID to remove

    Returns
    Type Description
    Task

    Awaitable task

    Exceptions
    Type Condition
    ArgumentNullException
    LobbyServiceException

    SendHeartbeatPingAsync(String)

    Send a heartbeat ping to keep the Lobby active. Async operation.

    Declaration
    Task SendHeartbeatPingAsync(string lobbyId)
    Parameters
    Type Name Description
    String lobbyId

    ID of the Lobby to ping

    Returns
    Type Description
    Task

    Awaitable task

    Exceptions
    Type Condition
    ArgumentNullException
    LobbyServiceException

    UpdateLobbyAsync(String, UpdateLobbyOptions)

    Update the specified Lobby with the given option parameters. Async operation.

    Declaration
    Task<Lobby> UpdateLobbyAsync(string lobbyId, UpdateLobbyOptions options)
    Parameters
    Type Name Description
    String lobbyId

    Lobby ID to update

    UpdateLobbyOptions options

    Parameters to update

    Returns
    Type Description
    Task<Lobby>

    Lobby data of the updated Lobby

    Exceptions
    Type Condition
    ArgumentNullException
    LobbyServiceException

    UpdatePlayerAsync(String, String, UpdatePlayerOptions)

    Update player lobby associated data with the given option parameters. Async operation.

    Declaration
    Task<Lobby> UpdatePlayerAsync(string lobbyId, string playerId, UpdatePlayerOptions options)
    Parameters
    Type Name Description
    String lobbyId
    String playerId
    UpdatePlayerOptions options
    Returns
    Type Description
    Task<Lobby>

    Lobby data of the updated Lobby

    Exceptions
    Type Condition
    ArgumentNullException
    LobbyServiceException
    Back to top
    Terms of use
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023