PlayResolver

The PlayResolver encapsulates all the internals to fetch and join both rooms and worlds.

using Coherence.Runtime;

// ensure connection to the play services backend
async Task<bool> PlayResolver.EnsurePlayConnection();

Rooms API

Detailed usage can be found in Rooms.

// Returns "local" as the region if local server is running.
async Task<string> FetchLocalRegions()

// Returns all the regions where rooms are enabled in the portal.
async Task<IReadOnlyList<string>> FetchRegions()

// Fetch a list of rooms currently active in the given region.
// Optionally, filter by tags provided when creating the room.
async Task<IReadOnlyList<RoomData>> FetchRooms(string region, string[] tags = null)

// Create a new room in the region. 
// Sample UI uses key value to set/get room names.
async Task<RoomData> CreateRoom(string region,
                                int maxClients = 10,
                                string[] tags = null, 
                                Dictionary<string, string> keyValues = null)

// Start connecting to the room. 
// IClient can be accessed through 
// MonoBridgeStore.GetBrige(gameObject.scene).Client
// connection success and can be monitored using IClient.OnConnected, etc events.
void JoinRoom(IClient client, RoomData room)

// Convert RoomData to EndpointData, to call IClient.Connect(endpoint) directly.
// The second return value is false if the room data is invalid. 
(EndpointData, bool) GetRoomEndpointData(RoomData room)

Example usage for Rooms API

Worlds API

Detailed usage can be found in Worlds.

Example usage for Worlds API

Last updated

Was this helpful?