Interface IMultiplayService
Interface of the Multiplay SDK for using the Multiplay Service.
Namespace: Unity.Services.Multiplay
Assembly: Unity.Services.Multiplay.dll
Syntax
public interface IMultiplayService
Properties
ServerConfig
Gets the server config for the current session.
Declaration
ServerConfig ServerConfig { get; }
Property Value
Type | Description |
---|---|
Server |
Methods
GetPayloadAllocationAsPlainText()
Gets the payload allocation as plain text.
Declaration
Task<string> GetPayloadAllocationAsPlainText()
Returns
GetPayloadAllocationFromJsonAs<TPayload>(bool)
Gets the payload allocation, in JSON, and deserializes it as the given object.
Declaration
Task<TPayload> GetPayloadAllocationFromJsonAs<TPayload>(bool throwOnMissingMembers = false)
Parameters
Type | Name | Description |
---|---|---|
bool | throwOnMissingMembers | Throws an exception if the given class is missing a member. |
Returns
Type | Description |
---|---|
Task<TPayload> | An object representing the payload allocation. |
Type Parameters
Name | Description |
---|---|
TPayload | The object to be deserialized as. |
ReadyServerForPlayersAsync()
Readies this server. To be called after the server has been Allocated to notify that the server is ready to accept players.
Declaration
Task ReadyServerForPlayersAsync()
Returns
Type | Description |
---|---|
Task | A task that should be awaited. |
StartServerQueryHandlerAsync(ushort, string, string, string, string)
Starts the server query handler. The handler provides the Multiplay Service with information about this server.
Declaration
Task<IServerQueryHandler> StartServerQueryHandlerAsync(ushort maxPlayers, string serverName, string gameType, string buildId, string map)
Parameters
Type | Name | Description |
---|---|---|
ushort | maxPlayers | The max players for this server. |
string | serverName | The name of this server. |
string | gameType | The game type of this server. |
string | buildId | The build ID of this server. |
string | map | The map of this server. |
Returns
Type | Description |
---|---|
Task<IServer |
A task returning a manager for changing the current response. |
SubscribeToServerEventsAsync(MultiplayEventCallbacks)
Subscribes to the SDK Daemon and provides updates via callbacks.
Declaration
Task<IServerEvents> SubscribeToServerEventsAsync(MultiplayEventCallbacks callbacks)
Parameters
Type | Name | Description |
---|---|---|
Multiplay |
callbacks | The callbacks to pass the updates to |
Returns
Type | Description |
---|---|
Task<IServer |
A task returning a handle for server event management. |
UnreadyServerAsync()
Unreadies this server. To be called to prevent the server being given new players.
Declaration
Task UnreadyServerAsync()
Returns
Type | Description |
---|---|
Task | A task that should be awaited. |