v1.0.0
Latest
2022.3+

Interface IMultiplayService

Interface of the Multiplay SDK for using the Multiplay Service.

Namespace: Unity.Services.Multiplay
Syntax
public interface IMultiplayService

Properties

ServerConfig

Gets the server config for the current session.

Declaration
ServerConfig ServerConfig { get; }
Property Value
TypeDescription
ServerConfig

Methods

GetPayloadAllocationAsPlainText()

Gets the payload allocation as plain text.

Declaration
Task<string> GetPayloadAllocationAsPlainText()
Returns
TypeDescription
System.Threading.Tasks.Task<System.String>

The payload allocation as plain text.

GetPayloadAllocationFromJsonAs<TPayload>(Boolean)

Gets the payload allocation, in JSON, and deserializes it as the given object.

Declaration
Task<TPayload> GetPayloadAllocationFromJsonAs<TPayload>(bool throwOnMissingMembers = false)
Parameters
TypeNameDescription
System.BooleanthrowOnMissingMembers

Throws an exception if the given class is missing a member.

Returns
TypeDescription
System.Threading.Tasks.Task<TPayload>

An object representing the payload allocation.

Type Parameters
NameDescription
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
TypeDescription
System.Threading.Tasks.Task

A task that should be awaited.

StartServerQueryHandlerAsync(UInt16, 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
TypeNameDescription
System.UInt16maxPlayers

The max players for this server.

System.StringserverName

The name of this server.

System.StringgameType

The game type of this server.

System.StringbuildId

The build ID of this server.

System.Stringmap

The map of this server.

Returns
TypeDescription
System.Threading.Tasks.Task<IServerQueryHandler>

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
TypeNameDescription
MultiplayEventCallbackscallbacks

The callbacks that will be executed to respond to the server events.

Returns
TypeDescription
System.Threading.Tasks.Task<IServerEvents>

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
TypeDescription
System.Threading.Tasks.Task

A task that should be awaited.