While working with the MatchMaker (NetworkMatch), I’ve noticed a lot of issues creating and joining matches. Tested with both 5.1.1f1 and 5.1.1p1.
[A sample project is attached below, but all you need is a NetworkManager (or NetworkLobbyManager) and a NetworkManagerHUD. Don’t forget to set your Cloud Project ID in the Player Settings.]
Here are some test cases with 2 Clients:
a) Client 1 creates an internet match, stops the Match Maker, starts the Match Maker again, and creates a new, second internet match.
Error: host id out of bound id {-1} max id should be greater 0 and less than {1}
UnityEngine.Networking.Match.c__Iterator01:MoveNext()* *Error: Host doesn't exist* *UnityEngine.Networking.Match.<ProcessMatchResponse>c__Iterator0
1:MoveNext()
The new match will be created regardless, but when Client 2 tries to join, he gets a timeout.
b) Client 1 creates an internet match, stops the Match Maker, starts the Match Maker again, goes to “Find Internet Match” and joins the match he just created.
Error: ArgumentException: An element with the same key already exists in the dictionary.
System.Collections.Generic.Dictionary`2[UnityEngine.Networking.Types.NetworkID,UnityEngine.Networking.Types.NetworkAccessToken].Add (NetworkID key, UnityEngine.Networking.Types.NetworkAccessToken value) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:404)
This probably happens due to the OnMatchJoined callback inside the JoinMatch() call, which always tries to set an access token.
c) Client 1 creates an internet match and leaves.
Client 2 finds that (now empty) match and tries to join. Result: Timeout.
Conclusion: Apparently, the ONLY way to get 2 Clients in the same match together is, if one client creates a match (without ever going back), and the other client joins (and also never goes back). If any involved client exits the lobby, they won’t be able to get together again. Unless they restart the game and start over.
Any info or suggestions are much appreciated.
2177924–144257–MatchMaker.zip (1.02 MB)