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 |
---|---|
IRead |
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. |
Create |
createSessionOptions | The options to create the Session. |
Returns
CreateSessionAsync(CreateSessionOptions)
Creates a Session.
Declaration
Task<IHostSession> CreateSessionAsync(CreateSessionOptions options)
Parameters
Type | Name | Description |
---|---|---|
Create |
options | The options for the Session creation. |
Returns
Type | Description |
---|---|
Task<IHost |
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. |
Join |
options | The options to join the Session. |
Returns
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. |
Join |
options | The options to join the Session. |
Returns
QuerySessionsAsync(QuerySessionsOptions)
Query available sessions
Declaration
Task<QuerySessionsResults> QuerySessionsAsync(QuerySessionsOptions options)
Parameters
Type | Name | Description |
---|---|---|
Query |
options | The query options for the search |
Returns
Type | Description |
---|---|
Task<Query |
QuickJoinSessionAsync(QuickJoinSessionOptions)
Quick join a Session.
Declaration
Task<ISession> QuickJoinSessionAsync(QuickJoinSessionOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
Quick |
options | The quick join options |
Returns
Events
SessionAdded
Raised when a new session is added
Declaration
event Action<ISession> SessionAdded