Class Player
Information about a specific player creating, joining, or already in a lobby.
Inherited Members
Namespace: Unity.Services.Apis.Lobbies
Assembly: Unity.Services.Apis.dll
Syntax
[DataContract(Name = "Player")]
[Preserve]
public class Player
Constructors
Player(string, PlayerProfile, string, Dictionary<string, PlayerDataObject>, string, DateTime, DateTime)
Initializes a new instance of the Player class.
Declaration
[Preserve]
public Player(string id = null, PlayerProfile profile = null, string connectionInfo = null, Dictionary<string, PlayerDataObject> data = null, string allocationId = null, DateTime joined = default, DateTime lastUpdated = default)
Parameters
Type | Name | Description |
---|---|---|
string | id | The unique identifier for the player. If not provided for a create or join request, it will be set to the ID of the caller.. |
Player |
profile | profile. |
string | connectionInfo | Connection information for connecting to a relay with this player.. |
Dictionary<string, Player |
data | Custom game-specific properties that apply to an individual player (e.g. |
string | allocationId | The |
Date |
joined | The time at which the player joined the lobby.. |
Date |
lastUpdated | The last time the metadata for this player was updated.. |
Properties
AllocationId
The allocationId
from the Relay service which associates this player in this lobby with a persistent connection. When a disconnect notification is received, this value is used to identify the associated player in a lobby to mark them as disconnected.
Declaration
[DataMember(Name = "allocationId", EmitDefaultValue = true)]
[Preserve]
public string AllocationId { get; set; }
Property Value
Type | Description |
---|---|
string | The |
ConnectionInfo
Connection information for connecting to a relay with this player.
Declaration
[DataMember(Name = "connectionInfo", EmitDefaultValue = true)]
[Obsolete]
[Preserve]
public string ConnectionInfo { get; set; }
Property Value
Type | Description |
---|---|
string | Connection information for connecting to a relay with this player. |
Data
Custom game-specific properties that apply to an individual player (e.g. role
or skill
).
Declaration
[DataMember(Name = "data", EmitDefaultValue = true)]
[Preserve]
public Dictionary<string, PlayerDataObject> Data { get; set; }
Property Value
Type | Description |
---|---|
Dictionary<string, Player |
Custom game-specific properties that apply to an individual player (e.g. |
Id
The unique identifier for the player. If not provided for a create or join request, it will be set to the ID of the caller.
Declaration
[DataMember(Name = "id", EmitDefaultValue = true)]
[Preserve]
public string Id { get; set; }
Property Value
Type | Description |
---|---|
string | The unique identifier for the player. If not provided for a create or join request, it will be set to the ID of the caller. |
Joined
The time at which the player joined the lobby.
Declaration
[DataMember(Name = "joined", EmitDefaultValue = false)]
[Preserve]
public DateTime Joined { get; set; }
Property Value
Type | Description |
---|---|
Date |
The time at which the player joined the lobby. |
LastUpdated
The last time the metadata for this player was updated.
Declaration
[DataMember(Name = "lastUpdated", EmitDefaultValue = false)]
[Preserve]
public DateTime LastUpdated { get; set; }
Property Value
Type | Description |
---|---|
Date |
The last time the metadata for this player was updated. |
Profile
Gets or Sets Profile
Declaration
[DataMember(Name = "profile", EmitDefaultValue = false)]
[Preserve]
public PlayerProfile Profile { get; set; }
Property Value
Type | Description |
---|---|
Player |