Lesson 67 +10 XP

Unity Services

Unity Services

Unity Gaming Services (UGS) provides cloud services to support backend game operations, multiplayer matchmaking, and monetization.

Key Services

  • Authentication: Lets players log in anonymously, or link to Google, Apple, or steam accounts.
  • Lobby & Matchmaking: Allows players to host game lobbies, search for active sessions, and join multiplayer matches.
  • Cloud Save: Stores player progression, inventories, and settings securely in the cloud, rather than on local disk.
  • Economy: Manages virtual currencies, inventory items, and in-game shop items.
  • Analytics: Tracks player retention, session durations, and in-game events to help you improve design.
  • Monetization (Ads & IAP): Integrates advertisement banners and In-App Purchases (IAP) to generate revenue.

Initializing Services in C#

To connect your game to UGS, you initialize the services at startup:

using UnityEngine;
using Unity.Services.Core;
using System.Threading.Tasks;

public class GameInitializer : MonoBehaviour
{
    async void Start()
    {
        try
        {
            // Initialize all active Unity cloud services
            await UnityServices.InitializeAsync();
            Debug.Log("Unity Services Initialized!");
        }
        catch (System.Exception e)
        {
            Debug.LogError("Failed to initialize: " + e.Message);
        }
    }
}

TL;DR

  • Unity Gaming Services (UGS) are cloud backends managed via the Unity Dashboard.
  • Key services include Cloud Save, Authentication, Lobby, and Economy.
  • Call UnityServices.InitializeAsync() to establish connections to the cloud.
  • Manage pricing, analytics, and advertising via your online project portal.