This Unity Gaming Services (UGS) Samples package contains a collection of samples designed to show you how you can use multiple UGS products to solve common game development challenges. These samples implement typical backend game use cases and game design elements, show how to resolve specific development tasks, and highlight the efficiency you can achieve in your game backend by integrating different UGS packages in your project.
- Download Unity Editor 2021.3 or later
- Unity Hub
- Download (Win)
- Download (Mac)
- Clone the repository:
git clone https://github.com/Unity-Technologies/com.unity.services.samples.use-cases.git
- Open the project from the Unity Hub or Unity Editor
To view each sample in action, open the Start Here scene in the Assets directory and hit Play. To review an individual sample, find the use case directory in Assets/Use Case Samples and view the README file for implementation details.
Note: This project is tied to a Unity Services Account that allows read-only testing in the Editor. The messages "Unable to link project to Unity Services" in Project Settings and "Unable to access Unity Services" in Build Settings are expected. Additionally, you will be unable to create a device build of this project.
Note: This project uses the Unity Mediation package, which requires CocoaPods to be installed if building for iOS. If your project uses the Unity Mediation package, see that package's documentation on requirements and troubleshooting, before building for iOS.
- A/B Test on Game Difficulty - Segment players into multiple test groups in order to determine which variation of a specific variable is the most engaging to the players (in this case, the amount of XP required for leveling up).
- Battle Pass - A seasonal reward tier system with a free track and a premium track.
- Cloud AI Mini Game - Server authoritative gameplay in a simple Tic-Tac-Toe game played against AI running on UGS with persistent state, Currency rewards, stats, and straightforward AI.
- Command Batching - Group game Commands into a queue and process on the server in a single batch to reduce the volume and frequency of server calls made during gameplay.
- Daily Rewards - A prevalent engagement feature that can boost retention by showing players an escalating series of rewards incentivizes them to keep logging in to claim better and better prizes.
- Idle Clicker Game - Update server authoritative game state in real time, similar to idle clicker and social games with a merging mechanic and a generic Unlock Manager.
- In-Game Mailbox - Demonstrates a way that developers can send in-game messages to their players, including with gifts of various game currencies and inventory items.
- Loot Boxes - Reward players with a random Economy currency using Cloud Code to perform the Economy grants.
- Loot Boxes With Cooldown - Grant players random collections of both Currencies and Inventory Items at timed intervals.
- Seasonal Events - Update game content remotely based on timed special events.
- Serverless Multiplayer Game - Demonstrates how to utilize game lobbies and compete in a simple, serverless, real-time arena-style game where players collect coins for points.
- Starter Packs - Allow players to purchase a Starter Pack using Cloud Code to implement the one-time-only purchase.
- Virtual Shop - Demonstrates a key feature in many games: allowing players to use in-game currency to purchase items and resources to facilitate a server-authoritative in-game economy with multiple store pages and server-managed badges.
Tested with Unity 2021.3 for PC and Mac.
On top of this project, the following additional samples can help you implement UGS features in your games.
These samples use UGS packages which have already been configured so you can easily explore the use case samples provided.
To use these implementations in your own project, you will need to setup and configure the services used in your own UGS Dashboard. Learn more about each configuration in the README.md file within each samples directory.
Your opinion matters to us, and we would like to hear from you so we can provide you with the best learning material that’ll help you become a Unity Gaming Services expert in no time.
You can let us know how we're doing by filling out this anonymous, short survey - it should take less than a minute to fill out!
Alternatively, you can reach us for questions, or to offer feedback or ideas for new sample use cases in the Unity Gaming Services Forum (we even have a helpful tag to filter by!). Also, while in Play Mode in the samples project, you can submit anonymous feedback by using the feedback button in the bottom left corner of each scene.
Unity's Cloud Diagnostics service helps to ensure the quality of this project by automatically sending diagnostic data to the dashboard when you encounter errors. Additionally, the User Reporting feature lets you submit a screenshot and detailed feedback about a sample by clicking the Feedback button in any of the Sample scenes during Play Mode.
To set up Cloud Diagnostics and User Reporting in your own project, follow the set-up instructions provided in the dashboard. Setting up Cloud Diagnostics
Note: If you don't want to automatically send exception data, disable Cloud Diagnostics under Project Settings > Services > Cloud Diagnostics.