> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 可用的內建實體類型

> PlayFab 內建實體類型參考：namespace、title、master_player_account、title_player_account、character、group 和 game_server 的 EntityKey 值。

本主題說明您可用來建構 [EntityKey](/zh-TW/services/playfab/api-references/events/data-types/entitykey) 的可用實體類型。

在大部分較新的 API 方法中，實體索引鍵用於識別實體。

您可以使用 `EntityKey.Type` 欄位的值，來判斷要在 `ID` 欄位中設定的值類型。

<Note>
  實體索引鍵*會區分大小寫*。
</Note>

## namespace

`namespace` 實體代表跨遊戲的玩家身分和共用資料範圍。根據預設，它涵蓋工作室中的所有遊戲。發行者識別碼 (Publisher ID) 用於識別此命名空間；**publisher** 是同一範圍較舊的 API 用語。命名空間與工作室不同，工作室是一種管理分組。如需詳細資訊，請參閱 [PlayFab 概念](/zh-TW/services/playfab/get-started/concepts#studios-namespaces-and-titles)。

<Note>
  此實體的變更*不會*即時反映。
</Note>

將 `ID` 欄位設定為您遊戲的**發行者識別碼**。若要擷取您的**發行者識別碼**：

* 登入 [Game Manager](https://developer.playfab.com/)。
* 在 **Game Manager** 的左上角，選取齒輪圖示。
* 選取 **Title Settings**。
* 選取 **API Features**。
* **Publisher ID** (也就是命名空間識別碼) 會顯示在 **API ACCESS** 區段中。

## title

`title` 實體代表限定於單一遊戲範圍的全域資訊。遊戲是針對某款遊戲或遊戲環境的獨立 PlayFab 資源。

<Note>
  此實體的變更*不會*即時反映。
</Note>

將 `ID` 欄位設定為您遊戲的**遊戲識別碼**。若要擷取**遊戲識別碼**：

* 登入 [Game Manager](https://developer.playfab.com/)。
* 在 **Game Manager** 的左上角，選取齒輪圖示。
* 選取 **Title Settings**。
* 選取 **API Features**。
* **Title ID** 會顯示在 **API ACCESS** 區段中。

## master\_player\_account

`master_player_account` 是由與指定命名空間相關聯的所有遊戲共用的玩家實體。

將 `ID` 欄位設定為傳統 API 中的 `LoginResult.PlayFabId`。若要擷取 `LoginResult`，請呼叫 [Client Authentication](xref:titleid.playfabapi.com.client.authentication) 中的其中一個登入方法。

## title\_player\_account

對大多數開發人員而言，`title_player_account` 以最傳統的方式代表玩家。

在用戶端 API 中將 `ID` 欄位設定為 `LoginResult.EntityToken.Entity.Id`，或在驗證 API 中設定為 `GetEntityTokenResponse.Entity.Id`。

若要擷取 `LoginResult`，請呼叫 [Client Authentication](xref:titleid.playfabapi.com.client.authentication) 中的其中一個登入方法。
若要擷取 `GetEntityTokenResponse`，請呼叫 [Get Entity Token](xref:titleid.playfabapi.com.authentication.authentication.getentitytoken)。

## character

`character` 實體是 `title_player_account` 的子實體，直接對應[傳統 API 中的角色](xref:titleid.playfabapi.com.client.characters.getalluserscharacters)。

將 `ID` 欄位設定為 `result.Characters[i].CharacterId` 中的任何 `characterId`。

## group

`group` 實體是其他實體的容器。目前僅限於玩家和角色。

如果您正在建立群組，請將 `ID` 欄位設定為 `result.Group.Id`；在[列出您的成員資格](xref:titleid.playfabapi.com.groups.groups.listmembership)時，則設定為 `result.Groups[i].Group.Id`。

## game\_server

`game_server` 實體是遊戲伺服器使用的唯一實體，主要用於 Matchmaking 和 Lobby 功能。未來可能會新增其他情境以支援其他 PlayFab 功能。

此實體為遊戲伺服器提供專屬的身分，有助於唯一識別遊戲伺服器，以便訂閱 Matchmaking 和 Lobby 的即時更新，並支援大廳擁有者移轉等特定功能。

若要以 `game_server` 實體進行驗證，請以 title 實體身分呼叫 API [AuthenticateGameServerWithCustomId](xref:titleid.playfabapi.com.authentication.authentication.authenticategameserverwithcustomid)，並擷取 `game_server` 實體索引鍵和權杖組。透過 [PFMultiplayerSetEntityToken](/zh-TW/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pfmultiplayer/functions/pfmultiplayersetentitytoken) 使用 PlayFab Multiplayer SDK 時，請使用此實體索引鍵。


## Related topics

- [PFEntityKey.Type](/zh-TW/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/PFEntityKey/Type.md)
- [EntityObject](/zh-TW/services/playfab/api-references/events/data-types/entityobject.md)
- [EntityKey](/zh-TW/services/playfab/api-references/events/data-types/entitykey.md)
- [PFEntityKey 類別](/zh-TW/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/PFEntityKey/overview.md)
- [實體快速入門](/zh-TW/services/playfab/live-service-management/game-configuration/entities/quickstart.md)
