> ## 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.

# 搭配實體事件使用 PlayStream

> 使用 WriteEvents API 將批次實體事件傳送至 PlayStream，並針對玩家、遊戲、角色、群組等使用統一的實體事件模型。

PlayFab 推出了**實體事件模型**，這是對應於**實體程式設計模型**的新事件模型。[實體](/zh-TW/services/playfab/live-service-management/game-configuration/entities)是指任何包含資料的 PlayFab 概念，可以是玩家、遊戲、角色、群組等。

在傳統事件模型中，每種實體類型都有不同的事件和 API。例如，建立新實體時，您會根據所建立的實體類型看到 `group_created`、`character_created` 或 `player_created` 之類的事件。在實體事件模型下，只有單一事件 `entity_created` 涵蓋上述所有情況。

透過新的實體格式，我們得以簡化現有的不同 API 和事件數量。在我們完成移轉至新事件模型的期間，為了支援現有遊戲，您仍會在 PlayStream 監視器中看到傳統事件與實體事件並存。

實體事件支援下列 PlayFab 功能：

* **批次事件** - 使用 [WriteEvents](https://learn.microsoft.com/en-us/rest/api/playfab/events/play-stream-events/write-events?view=playfab-rest\&preserve-view=true) API 一次將多個實體事件寫入 PlayStream。
* **即時規則引擎** - 設定規則以即時回應流經 PlayStream 的實體事件，並觸發各種[動作](/zh-TW/services/playfab/data-analytics/acting-data/action-rules-overview)。PlayFab 支援對實體事件執行下列動作：
  * 執行自訂 CloudScript (包括搭配 Azure Functions 的 CloudScript)
  * 傳送電子郵件
* **即時偵錯工具** - 在 [PlayStream 監視器](/zh-TW/services/playfab/data-analytics/ingest-data/playstream-overview)中查看實體事件與傳統事件一起顯示。

<Note>
  PlayStream 目前不支援為名稱超過 40 個字元的事件建立規則。
</Note>

資料和分析功能也支援實體事件，讓您能探索遊戲的相關資訊：

* **PlayFab Insights** - 提供可一起檢查所有事件資料 (包括傳統事件和實體事件) 的工具。


## Related topics

- [PlayStream 事件功能](/zh-TW/services/playfab/data-analytics/ingest-data/playstream-event-capabilities.md)
- [使用自訂標記自訂您的事件](/zh-TW/services/playfab/data-analytics/ingest-data/playstream-custom-tags.md)
- [使用 Azure Functions 內容模型的 PlayFab CloudScript](/zh-TW/services/playfab/live-service-management/service-gateway/automation/cloudscript-af/CloudScript-af-context.md)
- [排行榜與 PlayStream 和 Telemetry](/zh-TW/services/playfab/community/leaderboards/leaderboards-with-playstream-and-telemetry.md)
- [搭配 PlayStream 和遙測使用統計資料](/zh-TW/services/playfab/player-progression/statistics/statistics-with-playstream-and-telemetry.md)
