Reputation: 1770
I created my how matchmaking class with unity. It all works fine on pc and am easily able to create a match without no problems. The problems came when I try to create a match for iOS.
When I try to create a new match I got this error on Xcode:
ArgumentNullException: Argument cannot be null.
Parameter name: baseUri
at System.Uri.Merge (System.Uri baseUri, System.String relativeUri) [0x00000] in <filename unknown>:0
at UnityEngine.Networking.Match.NetworkMatch.ListMatches (UnityEngine.Networking.Match.ListMatchRequest req, UnityEngine.Networking.Match.ResponseDelegate`1 callback) [0x00000] in <filename unknown>:0
(Filename: currently not available on il2cpp Line: -1)
Here is the code that use to crete the match:
void Start()
{
networkMatch = gameObject.AddComponent<NetworkMatch>();
}
private void OnMatchCreate(CreateMatchResponse matchResponse)
{
if (matchResponse.success)
{
NetworkServer.ClearLocalObjects ();
NetworkServer.ClearSpawners ();
NetworkServer.SetAllClientsNotReady ();
Debug.Log("Create match succeeded");
matchCreated = true;
Utility.SetAccessTokenForNetwork(matchResponse.networkId, new NetworkAccessToken(matchResponse.accessTokenString));
NetworkServer.Listen(new MatchInfo(matchResponse), 9000);
UnityEngine.Networking.NetworkManager.singleton.StartServer(new MatchInfo(matchResponse));
}
else
{
Debug.LogError ("Create match failed");
}
}
What is the problem here?
Upvotes: 3
Views: 530
Reputation: 1770
After investigation a bit I found a solution to this problem:
Final code:
void Start()
{
networkMatch = gameObject.AddComponent<NetworkMatch>();
networkMatch.baseUri = new System.Uri("https://mm.unet.unity3d.com/");
}
The URL is the default URL provided by Unity
Upvotes: 2