Combu  2.1.14
Unity API Documentation
Managing Matches

Table of Contents

In this section you will learn how to retrieve the matches list of the local user and how to add/remove matches.

Loading Matches

To retrieve the list of matches of the local user you need to call Match.Load:

// Load the active matches, no Tournament ID, no filter by title
Match.Load(0, true, string.Empty, (Matches[] matches) => {
Debug.Log("Matches loaded: " + matches.Length);
});

Loading by Match ID

You can also load a single Matches by its ID:

// Load a Matches by ID
Match.Load(123, (Match match) => {
if (match != null)
Debug.Log("Success: " + match.title);
else
Debug.Log("Failed");
});

Rounds of the Match

Once that the Match has been loaded, the property rounds gives you access to its rounds and scores: the collection users contains the MatchAccount objects (relationship between Match and Account), the collection scores contains the MatchRound objects (relationship between the Match-Account association and a round).

Quick Match

To create a quick match with another user you need to call Match.QuickMatch:

// Load 2 random users (not only friends), no filter by customData, 1 round
Match.QuickMatch(false, null, 1, (Match match) => {
if (match != null)
Debug.Log("Success: " + match.title);
else
Debug.Log("Failed");
});

Create your own Match

You can take a look at the code in Match.QuickMatch to see how to create a Match and use the code as base to create your own matches.

Sending Score

To send a score for the next round you need to call the method Score on a Match instance:

// Send a score of 1000
myMatch.Score(1000, (bool success, string error) => {
if (success)
Debug.Log("Success");
else
Debug.Log("Failed: " + error);
});

Removing Matches

To delete a match you need to call Match.Delete, or call the method Delete on a Match instance:

// Remove by Match ID
Match.Delete(123, (bool success, string error) => {
if (success)
Debug.Log("Success");
else
Debug.Log("Failed: " + error);
});
// Remove by Match object
myMatch.Delete( (bool success, string error) => {
if (success)
Debug.Log("Success");
else
Debug.Log("Failed: " + error);
});