Table of Contents

Class NetworkingUtils

public static class NetworkingUtils
Inheritance
NetworkingUtils
Inherited Members

Methods

CreateNewLobby(string, int, CreateLobbyOptions, UnityAction<Lobby>, UnityAction<Exception>)

public static IEnumerator CreateNewLobby(string name, int maxPlayers, CreateLobbyOptions lobbyOptions, UnityAction<Lobby> onComplete, UnityAction<Exception> onError)

Parameters

name string
maxPlayers int
lobbyOptions CreateLobbyOptions
onComplete UnityAction<Lobby>
onError UnityAction<Exception>

Returns

IEnumerator

CreateRelayHost(int, UnityAction<Allocation>, UnityAction<Exception>)

public static IEnumerator CreateRelayHost(int maxPlayers, UnityAction<Allocation> onComplete, UnityAction<Exception> onError)

Parameters

maxPlayers int
onComplete UnityAction<Allocation>
onError UnityAction<Exception>

Returns

IEnumerator

GetNewPlayer(string)

public static Player GetNewPlayer(string playerId)

Parameters

playerId string

Returns

Player

JoinLobby(Player, string, string, UnityAction<Lobby>, UnityAction<Exception>)

public static IEnumerator JoinLobby(Unity.Services.Lobbies.Models.Player player, string lobbyId, string password, UnityAction<Lobby> onComplete, UnityAction<Exception> onError)

Parameters

player Player
lobbyId string
password string
onComplete UnityAction<Lobby>
onError UnityAction<Exception>

Returns

IEnumerator

JoinRelay(string, UnityAction<JoinAllocation>, UnityAction<Exception>)

public static IEnumerator JoinRelay(string joinCode, UnityAction<JoinAllocation> onComplete, UnityAction<Exception> onError)

Parameters

joinCode string
onComplete UnityAction<JoinAllocation>
onError UnityAction<Exception>

Returns

IEnumerator

LeaveLobby(LobbyManager, string, UnityAction, UnityAction<Exception>)

public static IEnumerator LeaveLobby(this LobbyManager lobbyManager, string playerId, UnityAction onComplete, UnityAction<Exception> onError)

Parameters

lobbyManager LobbyManager
playerId string
onComplete UnityAction
onError UnityAction<Exception>

Returns

IEnumerator

LobbyOptions(Player, string, bool, Dictionary<string, DataObject>)

public static CreateLobbyOptions LobbyOptions(Player player, string password, bool isPrivate, Dictionary<string, DataObject> data)

Parameters

player Player
password string
isPrivate bool
data Dictionary<string, DataObject>

Returns

CreateLobbyOptions

QueryLobbies(bool, UnityAction<List<Lobby>>, UnityAction<Exception>)

public static IEnumerator QueryLobbies(bool includePrivate, UnityAction<List<Lobby>> onComplete, UnityAction<Exception> onError)

Parameters

includePrivate bool
onComplete UnityAction<List<Lobby>>
onError UnityAction<Exception>

Returns

IEnumerator

QueryLobbies(int, bool, UnityAction<List<Lobby>>, UnityAction<Exception>, Dictionary<string, string>)

public static IEnumerator QueryLobbies(int count, bool includePrivate, UnityAction<List<Lobby>> onComplete, UnityAction<Exception> onError, Dictionary<string, string> filters = null)

Parameters

count int
includePrivate bool
onComplete UnityAction<List<Lobby>>
onError UnityAction<Exception>
filters Dictionary<string, string>

Returns

IEnumerator

QuickJoinOrCreate(Player, string, int, CreateLobbyOptions, UnityAction<Lobby>, UnityAction<Exception>, int, string)

public static IEnumerator QuickJoinOrCreate(Player player, string lobbyName, int maxPlayers, CreateLobbyOptions createOptions, UnityAction<Lobby> onComplete, UnityAction<Exception> onError, int totalCount = 20, string mode = "")

Parameters

player Player
lobbyName string
maxPlayers int
createOptions CreateLobbyOptions
onComplete UnityAction<Lobby>
onError UnityAction<Exception>
totalCount int
mode string

Returns

IEnumerator

RemoveLobbyDataKey(Lobby, string, UnityAction<Lobby>, UnityAction<Exception>)

public static IEnumerator RemoveLobbyDataKey(Lobby currentLobby, string key, UnityAction<Lobby> onComplete, UnityAction<Exception> onError)

Parameters

currentLobby Lobby
key string
onComplete UnityAction<Lobby>
onError UnityAction<Exception>

Returns

IEnumerator

StartMatchMaking(CancellationTokenSource, UnityAction<ISession>, UnityAction<Exception>, string, ushort, string)

Initiates the matchmaking process using UGS Matchmaker and automatically configures Unity Relay for the resulting session.

public static IEnumerator StartMatchMaking(CancellationTokenSource ct, UnityAction<ISession> onComplete, UnityAction<Exception> onError, string sessionType = "matchmade", ushort maxPlayers = 2, string queueName = "DefaultQueue")

Parameters

ct CancellationTokenSource

CancellationTokenSource for stopping the polling process.

onComplete UnityAction<ISession>

Callback providing the ISession object upon successful matchmaking.

onError UnityAction<Exception>

Callback for handling exceptions.

sessionType string
maxPlayers ushort

The maximum number of players allowed in the match.

queueName string

The name of the Matchmaker Queue configured in the UGS Dashboard.

Returns

IEnumerator

StartRelayServer(Allocation)

public static void StartRelayServer(Allocation allocation)

Parameters

allocation Allocation

UpdateLobby(Lobby, string, DataObject, UnityAction<Lobby>, UnityAction<Exception>)

public static IEnumerator UpdateLobby(Lobby currentLobby, string key, DataObject dataObject, UnityAction<Lobby> onComplete, UnityAction<Exception> onError)

Parameters

currentLobby Lobby
key string
dataObject DataObject
onComplete UnityAction<Lobby>
onError UnityAction<Exception>

Returns

IEnumerator

UpdatePlayerData(Lobby, string, string, string, UnityAction<Lobby>, UnityAction<Exception>)

public static IEnumerator UpdatePlayerData(Lobby currentLobby, string playerId, string key, string value, UnityAction<Lobby> onComplete, UnityAction<Exception> onError)

Parameters

currentLobby Lobby
playerId string
key string
value string
onComplete UnityAction<Lobby>
onError UnityAction<Exception>

Returns

IEnumerator