Requirements
Unity 2018.3.1f1+
The project requires Unity 2018.3.1f1 or later.
Visual Studio 2017+
Visual Studio 2017 (Update 15.7) or later is required to build the project.
Android / iOS device
A physical or virtual device provides the best experience.
PlayFab title
The sample is pre-configured with Title ID FACD and works out of the box. Custom titles require additional configuration.
PlayFab configuration
If you use your own PlayFab title instead of the default FACD title, configure the following resources in the PlayFab Game Manager.Leaderboards
Create the statistics below as Manual reset, Sum aggregation:| Statistic name | Reset | Aggregation |
|---|---|---|
games_played | Manual | Sum |
satellite_hit | Manual | Sum |
satellites_destroyed | Manual | Sum |
total_damage | Manual | Sum |
total_round_time | Manual | Sum |
Title Data
| Key | Value |
|---|---|
MOTD | A string displayed as the in-game Message of the Day |
CloudScript
Add the following CloudScript to your title. The handlers read stat updates from PlayStream events and persist them to player statistics:Automation rules
Create two PlayStream automation rules to link client events to the CloudScript handlers:| Rule name | Event type | Action | CloudScript function |
|---|---|---|---|
update_statstic | Custom Event — update_statstic | Execute Cloud Script | updateStatistic |
update_statstics | Custom Event — update_statstics | Execute Cloud Script | updateStatistics |
The rule names intentionally match the event names emitted by the client, which contain the typos
statstic / statstics. Use these exact strings when creating the rules.Setup
Configure PlayFab (optional)
The project defaults to Title ID FACD. To use your own title, update the Title ID via the PlayFab Editor Extensions or in
PlayFabSharedSettings.asset, then complete the PlayFab configuration steps above.Using the sample
After passing the welcome screen you are prompted to sign in (existing account, new account, or guest). Once signed in:- Play — fly around the space arena and destroy enemy satellites.
- Leaderboards — view rankings for all tracked statistics.
- Options — set a custom display name or clear saved sign-in information.
Code structure
Scripts live inAssets/Scripts/, split into three groups:
Game scripts
Game scripts
Core gameplay logic: spaceship movement, collision detection, satellite spawning, and round timing.
PlayFab scripts
PlayFab scripts
Handles authentication, reading Title Data and User Title Data, posting PlayStream events (
update_statstic, update_statstics), and fetching leaderboard data.UI scripts
UI scripts
Manages the welcome screen, sign-in flow, main menu, leaderboard display, and options panel.
Key PlayFab features
User accounts
Email/password, guest, and remembered-session login using the PlayFab Auth APIs.
Title Data
Reads server-side key/value pairs (e.g.,
MOTD) to drive in-game content without a client update.User Title Data
Stores per-player preferences and data dynamically created and updated from the client.
PlayStream events + CloudScript
Client fires custom events; automation rules route them to CloudScript handlers that update player statistics server-side.
Leaderboards
Displays ranked statistics for games played, hits, destroys, damage, and round time.
