Anyone know of a tutorial or project that has a working matchmaker? The sample projects pinned to this thread pretty much all have internal errors just when loading them up, or I would try to get it working with one of them....
This is a modified version of an example I found earlier. It covers most of the basics of the matchmaker service Code (CSharp): public enum ConnectionType { Disconnected, Client, Server, Host } void Start() { StartMatchMaker(); RefreshServerList(); } public static ConnectionType connectionType = ConnectionType.Disconnected; public void RefreshServerList() { matchMaker.ListMatches(0, 20, "", OnMatchList); } public override void OnMatchList(ListMatchResponse matchListResponse) { if (matchListResponse.success && matchListResponse.matches != null) { serverBrowser.ClearServerInfo(); //insert code to display match list } } public override void OnMatchCreate(CreateMatchResponse matchResponse) { if (matchResponse.success) { Debug.Log("Create match succeeded"); Utility.SetAccessTokenForNetwork(matchResponse.networkId, new NetworkAccessToken(matchResponse.accessTokenString)); NetworkServer.Listen(new MatchInfo(matchResponse), 9000); if (connectionType == ConnectionType.Host) StartHost(matchInfo); else StartServer(matchInfo); } else { Debug.LogError("Create match failed"); } } public void CreateMatch() { CreateMatchRequest create = new CreateMatchRequest(); create.name = "NewRoom"; create.size = 8; create.advertise = true; create.password = ""; matchMaker.CreateMatch(create, OnMatchCreate); } public void OnMatchJoined(JoinMatchResponse matchJoin) { if (matchJoin.success) { Debug.Log("Join match succeeded"); if (matchCreated) { Debug.LogWarning("Match already set up, aborting..."); return; } Utility.SetAccessTokenForNetwork(matchJoin.networkId, new NetworkAccessToken(matchJoin.accessTokenString)); NetworkClient myClient = new NetworkClient(); myClient.RegisterHandler(MsgType.Connect, OnMatchConnected); myClient.Connect(new MatchInfo(matchJoin)); StartClient(matchInfo); } else { Debug.LogError("Join match failed"); isClient = false; } } public void JoinMatch(MatchInfo match) { matchMaker.JoinMatch(match.networkId, "", OnMatchJoined); }