Requirements
Unity 2018.3+
The project was created with Unity 2018.3 and requires that version or later.
Visual Studio 2017+
Visual Studio 2017 (Update 15.7) or later is required to build the project.
PlayFab title
A PlayFab title with currency and catalog data imported.
PlayFab configuration
Before running the sample, import the bundled configuration files into your title via Game Manager:| Asset file | Import location |
|---|---|
PlayFabEventsUnity_Currency.json | Economy → Currency |
PlayFabEventsUnity_Characters.json | Economy → Catalogs |
Assets/PlayFabSdk/Shared/Public/Resources/PlayFabSharedSettings.asset.
Setup
Import the configuration assets
In Game Manager, import
PlayFabEventsUnity_Currency.json under Economy → Currency and PlayFabEventsUnity_Characters.json under Economy → Catalogs.Set your Title ID
Open
Assets/PlayFabSdk/Shared/Public/Resources/PlayFabSharedSettings.asset in the Unity Inspector and replace the placeholder Title ID with your own.Using the sample
The sample displays a set of buttons, each mapped to a specific event type:- Click any button to fire the corresponding event to PlayFab.
- Open Game Manager → Analytics → PlayStream to observe the event appear in real time.
Event scopes
Player events
Player events
Scoped to a specific player. Use the
WritePlayerEvent API. Ideal for tracking individual player actions such as level completion, item use, or quest progress.Title events
Title events
Scoped to the entire title rather than a single player. Use the
WriteTitleEvent API. Useful for server-wide occurrences or administrative triggers.Character events
Character events
Scoped to a specific character owned by a player. Use the
WriteCharacterEvent API. Requires at least one character to exist on the account, which is why the character catalog must be imported first.Key PlayFab features
WritePlayerEvent
Sends a custom event associated with the logged-in player to the PlayStream pipeline.
WriteTitleEvent
Sends a custom event associated with the title (not any specific player).
WriteCharacterEvent
Sends a custom event associated with a specific character belonging to a player.
PlayStream
Real-time event pipeline in PlayFab that receives events, evaluates rules, and can trigger automation actions such as CloudScript execution or push notifications.
