In Unity 5.4 we made a number of changes to the matchmaking API. Our intent was to simplify and clean up the API.
If you used the matchmaking API in an earlier version of Unity, you will need to check and update the classes and functions listed below.
MatchDesc has been renamed to MatchInfoSnapshot.
All request and response classes are removed, so there are no longer any overloaded functions in NetworkMatch. Instead we updated the parameter list of all functions to accommodate the loss of the missing classes and we updated the 2 delegates.
using UnityEngine;
using UnityEngine.__Networking__The Unity system that enables multiplayer gaming across a computer network. [More info](UNetOverview.html)<span class="tooltipGlossaryLink">See in [Glossary](Glossary.html#Networking)</span>;
using UnityEngine.Networking.Match;
NetworkMatch matchMaker;
void Awake()
{
matchMaker = gameObject.AddComponent<NetworkMatch>();
}
CreateMatchRequest create = new CreateMatchRequest();
...
matchMaker.CreateMatch(create, OnMatchCreate);
Or
matchMaker.CreateMatch("roomName", 4, true, "", OnMatchCreate);
Is now:
matchMaker.CreateMatch("roomName", 4, true, "", "", "", 0, 0, OnMatchCreate);
public void OnMatchCreate(CreateMatchResponse matchResponse)
{
...
}
Is now:
public void OnMatchCreate(bool success, string extendedInfo, MatchInfo matchInfo)
{
...
}
ListMatchRequest list = new ListMatchRequest();
matchMaker.ListMatches(list, OnMatchList);
Or
matchMaker.ListMatches(0, 10, "", OnMatchList);
Is now:
matchMaker.ListMatches(0, 10, "", true, 0, 0, OnMatchList);
public void OnMatchList(ListMatchResponse matchListResponse)
{
...
}
Is now:
public void OnMatchList(bool success, string extendedInfo, List<MatchInfoSnapshot> matches)
{
...
}
JoinMatchRequest join = new JoinMatchRequest();
matchMaker.JoinMatch(join, OnMatchJoined);
Or
matchMaker.JoinMatch(match.networkId, "", OnMatchJoined);
Is now:
matchMaker.JoinMatch(networkId, "" , "", "", 0, 0, OnMatchJoined);
public void OnMatchJoined(JoinMatchResponse matchJoin)
{
...
}
Is now:
public void OnMatchJoined(bool success, string extendedInfo, MatchInfo matchInfo)
{
...
}
DestroyMatchRequest destroy = DestroyMatchRequest();
matchMaker.DestroyMatch(destroy, OnMatchDestroy);
Or
matchMaker.DestroyMatch(netId, OnDestroy);
Is now:
matchMaker.DestroyMatch(netId, 0, OnMatchDestroy);
public void OnMatchDestroy(BasicResponse response)
{
...
}
Is now:
public void OnMatchDestroy(bool success, string extendedInfo)
{
...
}
DropConnectionRequest drop = DropConnectionRequest();
matchMaker.DropConnection(drop, OnMatchDropConnection);
Or
matchMaker.DropConnection(netId, nodeId, OnMatchDropConnection);
Is now:
matchMaker.DropConnection(netId, nodeId, 0, OnMatchDropConnection);
public void OnMatchDropConnection(BasicResponse response)
{
...
}
Is now:
public void OnMatchDropConnection(bool success, string extendedInfo)
{
...
}
Did you find this page useful? Please give it a rating: