Getting a list of rooms

Now that we're connected to Player.IO, and to our local server, we can get a list of rooms.

using UnityEngine;
using System.Collections;

using PlayerIOClient;

public class ConnectToPlayerIO : MonoBehaviour
{
  public bool UseDevServer = true;

  Client client;

  void Start()
  {
    PlayerIO.UnityInit( this );

    PlayerIO.Connect( "YourGameIDHere", "public", "YourUserIDHere", null, null,
    delegate( Client c )
    {
      // connected successfully
      client = c;
      Debug.Log( "Connected" );

      // if we're using the dev server, connect to the local IP
      if( UseDevServer )
      {
        client.Multiplayer.DevelopmentServer = new ServerEndpoint( "127.0.0.1", 8184 );
        GetRoomList(); } }, delegate( PlayerIOError error ) { // did not connect successfully Debug.Log( error.Message ...

Get Unity Multiplayer Games now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.