Version: 2019.2
Method group is Obsolete

NetworkMatch.CreateMatch

Switch to Manual
Obsolete public Coroutine CreateMatch (string matchName, uint matchSize, bool matchAdvertise, string matchPassword, string publicClientAddress, string privateClientAddress, int eloScoreForMatch, int requestDomain, DataResponseDelegate<MatchInfo> callback);

Parameters

matchNameThe text string describing the name for this match.
matchSizeWhen creating a match, the matchmaker will use either this value, or the maximum size you have configured online at https://multiplayer.unity3d.com, whichever is lower. This way you can specify different match sizes for a particular game, but still maintain an overall size limit in the online control panel.
matchAdvertiseA bool indicating if this match should be available in NetworkMatch.ListMatches results.
matchPasswordA text string indicating if this match is password protected. If it is, all clients trying to join this match must supply the correct match password.
publicClientAddressThe optional public client address. This value is stored on the matchmaker and given to clients listing matches. It is intended to be a network address for connecting to this client directly over the internet. This value will only be present if a publicly available address is known, and direct connection is supported by the matchmaker.
privateClientAddressThe optional private client address. This value is stored on the matchmaker and given to clients listing matches. It is intended to be a network address for connecting to this client directly on a local area network. This value will only be present if direct connection is supported by the matchmaker. This may be an empty string and it will not affect the ability to interface with matchmaker or use relay server.
eloScoreForMatchThe Elo score for the client hosting the match being created. If this number is set on all clients to indicate relative skill level, this number is used to return matches ordered by those that are most suitable for play given a listing player's skill level. This may be 0 on all clients, which would disable any Elo calculations in the MatchMaker.
requestDomainThe request domain for this request. Only requests in the same domain can interface with each other. For example if a NetworkMatch.CreateMatch is made with domain 1, only ListMatches that also specify domain 1 will find that match. Use this value to silo different (possibly incompatible) client versions.
callbackThe callback to be called when this function completes. This will be called regardless of whether the function succeeds or fails.

Returns

Coroutine This function is asynchronous and will complete at some point in the future, when the coroutine has finished communicating with the service backend.

Description

Use this function to create a new match. The client which calls this function becomes the host of the match.

When creating a match you should call this function and wait for the callback to be invoked before proceeding. The callback will indicate if the call was successful as well as extended information if it failed. After receiving the response callback you then should call StartHost() with the passed in MatchInfo.

using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.Networking.Match;

public class ExampleScript : MonoBehaviour { void Start() { NetworkManager.singleton.StartMatchMaker(); NetworkManager.singleton.matchMaker.CreateMatch("roomName", 4, true, "", "", "", 0, 0, OnMatchCreate); }

public void OnMatchCreate(bool success, string extendedInfo, MatchInfo matchInfo) { // ... } }