Class Lobby
Data about an individual lobby.
Inherited Members
Namespace: Unity.Services.Lobbies.Models
Assembly: Unity.Services.Multiplayer.dll
Syntax
[Preserve]
[DataContract(Name = "Lobby")]
public class Lobby
Constructors
Lobby(string, string, string, string, string, int, int, bool, bool, List<Player>, Dictionary<string, DataObject>, string, DateTime, DateTime, int, bool)
Data about an individual lobby.
Declaration
[Preserve]
public Lobby(string id = null, string lobbyCode = null, string upid = null, string environmentId = null, string name = null, int maxPlayers = 0, int availableSlots = 0, bool isPrivate = false, bool isLocked = false, List<Player> players = null, Dictionary<string, DataObject> data = null, string hostId = null, DateTime created = default, DateTime lastUpdated = default, int version = 0, bool hasPassword = false)
Parameters
Type | Name | Description |
---|---|---|
string | id | id param |
string | lobbyCode | A short code that can be used to join a lobby. This is only visible to lobby members. Typically this is displayed to the user so they can share it with other players out-of-game. Users with the code can join a lobby even when it is private. |
string | upid | The Unity project ID of the game. |
string | environmentId | The ID of the environment this lobby exists in. |
string | name | The name of the lobby. Typically this is shown in game UI to represent the lobby. |
int | maxPlayers | The maximum number of players that can be members of the lobby. |
int | availableSlots | The number of remaining open slots for players before the lobby becomes full. |
bool | isPrivate | Whether or not the lobby is private. Private lobbies do not appear in query results and cannot be fetched by non-members using the GetLobby API. If the lobby is not publicly visible, the creator can share the |
bool | isLocked | Whether or not the lobby is locked. If true, new players will not be able to join. |
List<Player> | players | The members of the lobby. |
Dictionary<string, DataObject> | data | Properties of the lobby set by the host. |
string | hostId | The ID of the player that is the lobby host. |
DateTime | created | When the lobby was created. The timestamp is in UTC and conforms to ISO 8601. |
DateTime | lastUpdated | When the lobby was last updated. The timestamp is in UTC and conforms to ISO 8601. |
int | version | The current version of the lobby. Incremented when any non-private lobby data changes. |
bool | hasPassword | Indicates whether or not a password is required to join the lobby. Players wishing to join must provide the matching password or will be rejected. |
Properties
AvailableSlots
The number of remaining open slots for players before the lobby becomes full.
Declaration
[Preserve]
[DataMember(Name = "availableSlots", EmitDefaultValue = false)]
public int AvailableSlots { get; }
Property Value
Type | Description |
---|---|
int |
Created
When the lobby was created. The timestamp is in UTC and conforms to ISO 8601.
Declaration
[Preserve]
[DataMember(Name = "created", EmitDefaultValue = false)]
public DateTime Created { get; }
Property Value
Type | Description |
---|---|
DateTime |
Data
Properties of the lobby set by the host.
Declaration
[Preserve]
[DataMember(Name = "data", EmitDefaultValue = false)]
public Dictionary<string, DataObject> Data { get; }
Property Value
Type | Description |
---|---|
Dictionary<string, DataObject> |
EnvironmentId
The ID of the environment this lobby exists in.
Declaration
[Preserve]
[DataMember(Name = "environmentId", EmitDefaultValue = false)]
public string EnvironmentId { get; }
Property Value
Type | Description |
---|---|
string |
HasPassword
Indicates whether or not a password is required to join the lobby. Players wishing to join must provide the matching password or will be rejected.
Declaration
[Preserve]
[DataMember(Name = "hasPassword", EmitDefaultValue = true)]
public bool HasPassword { get; }
Property Value
Type | Description |
---|---|
bool |
HostId
The ID of the player that is the lobby host.
Declaration
[Preserve]
[DataMember(Name = "hostId", EmitDefaultValue = false)]
public string HostId { get; }
Property Value
Type | Description |
---|---|
string |
Id
Parameter id of Lobby
Declaration
[Preserve]
[DataMember(Name = "id", EmitDefaultValue = false)]
public string Id { get; }
Property Value
Type | Description |
---|---|
string |
IsLocked
Whether or not the lobby is locked. If true, new players will not be able to join.
Declaration
[Preserve]
[DataMember(Name = "isLocked", EmitDefaultValue = true)]
public bool IsLocked { get; }
Property Value
Type | Description |
---|---|
bool |
IsPrivate
Whether or not the lobby is private. Private lobbies do not appear in query results and cannot be fetched by non-members using the GetLobby API. If the lobby is not publicly visible, the creator can share the lobbyCode
with other users who can use it to join this lobby.
Declaration
[Preserve]
[DataMember(Name = "isPrivate", EmitDefaultValue = true)]
public bool IsPrivate { get; }
Property Value
Type | Description |
---|---|
bool |
LastUpdated
When the lobby was last updated. The timestamp is in UTC and conforms to ISO 8601.
Declaration
[Preserve]
[DataMember(Name = "lastUpdated", EmitDefaultValue = false)]
public DateTime LastUpdated { get; }
Property Value
Type | Description |
---|---|
DateTime |
LobbyCode
A short code that can be used to join a lobby. This is only visible to lobby members. Typically this is displayed to the user so they can share it with other players out-of-game. Users with the code can join a lobby even when it is private.
Declaration
[Preserve]
[DataMember(Name = "lobbyCode", EmitDefaultValue = false)]
public string LobbyCode { get; }
Property Value
Type | Description |
---|---|
string |
MaxPlayers
The maximum number of players that can be members of the lobby.
Declaration
[Preserve]
[DataMember(Name = "maxPlayers", EmitDefaultValue = false)]
public int MaxPlayers { get; }
Property Value
Type | Description |
---|---|
int |
Name
The name of the lobby. Typically this is shown in game UI to represent the lobby.
Declaration
[Preserve]
[DataMember(Name = "name", EmitDefaultValue = false)]
public string Name { get; }
Property Value
Type | Description |
---|---|
string |
Players
The members of the lobby.
Declaration
[Preserve]
[DataMember(Name = "players", EmitDefaultValue = false)]
public List<Player> Players { get; }
Property Value
Type | Description |
---|---|
List<Player> |
Upid
The Unity project ID of the game.
Declaration
[Preserve]
[DataMember(Name = "upid", EmitDefaultValue = false)]
public string Upid { get; }
Property Value
Type | Description |
---|---|
string |
Version
The current version of the lobby. Incremented when any non-private lobby data changes.
Declaration
[Preserve]
[DataMember(Name = "version", EmitDefaultValue = false)]
public int Version { get; set; }
Property Value
Type | Description |
---|---|
int |