/// <summary> /// Hosts a match. /// </summary> /// <param name="matchData">The matchdata describing the match.</param> /// <param name="maxPlayers">The max players that can connect to the match.</param> /// <param name="onMatchCreated">Callback when the match was created.</param> public void HostMatch(Dictionary <string, MatchData> matchData, int maxPlayers, Action <bool, Match> onMatchCreated) { Debug.Log("Hosting match"); NetworkManager.singleton.maxConnections = maxPlayers; // NetworkManager.singleton.StartHost(); matchUp.CreateMatch(maxPlayers, matchData, onMatchCreated); }
/// <summary>Create a match with some example match data</summary> public void CreateMatch() { // You can set MatchData when creating the match. (string, float, double, int, or long) var matchData = new Dictionary <string, MatchData>() { //{ "Match name", "Layla's Match" }, //{ "eloScore", 200 }, //{ "Region", "North America" }, //{ "Map name", "gh_test-level" }, //{ "Game type", "Capture the flag" }, { "Match name", matchName.text }, { "eloScore", 200 }, { "Region", "North America" }, { "Map name", map.text }, { "Game type", gametype.text }, }; // Create the Match with the associated MatchData matchUp.CreateMatch(networkManager.maxConnections + 1, matchData, OnMatchCreated); }