Lobby Member Data

Like what your seeing?

Consider supporting us as a GitHub Sponsor and get instant access to all our Unity assets, exclusive tools and assets, escalated support and issue tracking and our gratitude. These articles are made possible by our GitHub Sponsors ... become a sponsor today!


LobbyMemberData is a structure that wraps around LobbyData and UserData to simplify access to the lobby member metadata and related features for a specific user on a specific lobby. In most cases you would be working with the LobbyMemberData of the local user and can easily create the LobbyMemberData by reading it from the related lobby.
//Assuming we have a Lobby named myLobby
//We can get our LobbyMember by reading the me field
LobbyMemberData lobbyMember = myLobby.Me;
The most common thing to do with a LobbyMemberData is to set the metadata of that member.
lobbyMember["fieldName"] = "fieldValue";
You can learn more about Lobby metadata and LobbyMemberData metadata by reading this article.


public struct LobbyManagerData
Represents a user in a given lobby.
This structure does not store any data locally, it is simply a means by which you can simplify the reading and writing of data to and from a LobbyMemberData ...
For example to read the metadata of a field on a user you typically need to know the Lobby's ID and the User's ID and then call the API such as
var value = API.Matchmaking.Client.GetLobbyMemberData(lobby, user, metadataKey);
As you can see this is long and easily make a mistake with and so by using this tool we can simplify that as.
var value = lobbyMember[metadataKey];
You can get a list of the LobbyMemberData's in a Lobby or you can create the LobbyMemberData assuming you know the Lobby ID and the User's ID i.e.
var myMember = new LobbyMemberData { lobby = thisLobby, user = UserData.Me };
Is the exact same data as
var myMember = thisLobby.User;
which is the same data as
var myMember = thisLobby.Members.First(p => p.user = UserData.Me);


The ID of the lobby this member is a member of
public LobbyData lobby;


The ID of the user this represents
public UserData user;


A shortcut to read or write the user's lobby member metadata for the field z_heathenReady
public bool IsReady { get; set; }
This is the same as calling
lobbyMember["z_heathenReady"] = value.ToString();
to set a value or
var valueAsBool = bool.Parse(lobbyMember["z_heathenReady"]);
The read the value as a bool


A shortcut to read or write the user's lobby member metadata for the field z_heathenGameVersion
This is the same as calling
lobbyMember["z_heathenGameVersion"] = versionAsString;
to set a value or
var versionAsString = bool.Parse(lobbyMember["z_heathenGameVersion"]);
The read the value as a bool


this[string key]

public string this[string key];
Can be used to get or set metadata values on this user. Only the user its self can set metadata values.


public void Kick();
Kick this user from this lobby using the Heathen Kick list


public static LobbyMemberData Get(LobbyData lobby, UserData user);
This returns a lobby member data object for the indicated user, in the indicated lobby ... this assumes the member is in the lobby it does not test for this.
Generally your better to use
if(lobby.GetMember(UserData user, out LobbyMemberData memberData)
//The user is a member of the lobby memberData is valid
//The user is not a member of this lobby, member data is not valid