Version: 5.5

MasterServer.RequestHostList

Switch to Manual
public static void RequestHostList (string gameTypeName);

Description

Request a host list from the master server.

The list is available through MasterServer.PollHostList when it has arrived.

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { void Awake() { MasterServer.ClearHostList(); MasterServer.RequestHostList("LarusTest"); } void Update() { if (MasterServer.PollHostList().Length != 0) { HostData[] hostData = MasterServer.PollHostList(); int i = 0; while (i < hostData.Length) { Debug.Log("Game name: " + hostData[i].gameName); i++; } MasterServer.ClearHostList(); } } }