How do I pass data from the match into my allocator?
request.MatchmakingResults is your primary source of match context. Most of the match data you need sits on MatchmakingResults.MatchProperties, which is a Dictionary<string, object> populated by Matchmaker based on your pool and rules configuration. This includes standard values like "Region", "maxPlayers", and "Players" (the matched player list).
Per-player custom data configured at ticket creation is carried on each Player inside the Players entry, accessed as player.CustomData["yourKey"].
// Region — use IsNullOrEmpty, not ??, because the key can exist with an empty string value
var regionValue = request.MatchmakingResults.MatchProperties.GetValueOrDefault("Region")?.ToString();
var region = string.IsNullOrEmpty(regionValue) ? DefaultRegion : regionValue;
// Max players — lowercase key; may not be populated for every pool configuration, always set a fallback
var maxPlayers = Convert.ToInt32(
request.MatchmakingResults.MatchProperties.GetValueOrDefault("maxPlayers") ?? DefaultMaxPlayerCount);
// Per-player custom data — Players sits on MatchProperties as a JArray
if (request.MatchmakingResults.MatchProperties.TryGetValue("Players", out var playersObj)
&& playersObj is JArray playersArray)
{
var players = playersArray.ToObject<List<Player>>();
foreach (var player in players)
{
if (player.CustomData is JObject customData
&& customData.TryGetValue("myKey", out var myValue))
{
// use myValue
}
}
}How do I pass match data to my game server?
Serialize request.MatchmakingResults and include it as a payload when requesting the server from your provider. This gives your game server access to the full match context — player list, match ID, properties, and per-player custom data. The field name varies by provider.
var payload = JsonConvert.SerializeObject(request.MatchmakingResults); // GameLift: GameSessionData = payload // Others: check your provider's session creation API