• Manual
  • API Documentation
  • Integrations
  • Google Play Games

    Show / Hide Table of Contents
    • Introduction
    • Installation
    • Getting Started
    • Demos
    • The Save System API
    • Auto Save
    • Platforms
    • Security
    • Serialization
    • Supported Data Types
    • Migration
    • FAQ
    • Changelog
    • Extend
      • Overview
      • Converter
      • Encryption
      • Storage
    • Guides
      • Overview
      • Configuring Settings
      • Using Auto Save
      • Basic Saving and Loading
      • Saving and Loading Raw Data
      • Deleting the Data
      • Saving and Loading Images
      • Saving and Loading Scene Objects
      • Saving and Loading Assets
      • Saving and Loading Readonly Properties
    • Integrations
      • Overview
      • Google Play Games
      • Xbox Live
      • Bolt
      • Firebase
      • PlayFab
      • PlayMaker
      • Steam Auto-Cloud
      • Steamworks .NET
      • Facepunch Steamworks
      • Text Mesh Pro
    • Storage
      • Overview
      • Backup
      • Catalog
      • Meta Data
      • Built-in Storages
        • File
        • PlayerPrefs
        • Memory
      • Third-party Storages
        • Firebase
          • Realtime Database
          • Cloud Storage
          • Firestore
        • PlayFab
          • Entity Objects
          • Entity Files
          • User Data
        • Steam
          • Steamworks .NET
          • Facepunch Steamworks
        • Google Play
          • Saved Game
        • Xbox Live
          • Connected Storage

    Google Play Games Integration

    This integration provides storage function for Google Play Games Saved Game feature that allows you to save / load data into the player's google play account.

    By using this approach, you save on cloud hosting costs and keep the data safe while the user has the ability to change devices without losing their progress.

    Getting Started

    1. Download and Install Google Play Games plugin for Unity
      1. Configure your Game on Google Play Console
      2. Complete the Setup Checklist
      3. Android Setup
    2. Download and Install Google Play Games Integration for Save System
    3. (Deprecated) This initialization part was necessary prior to Sign-in v2 of Google Play Games plugin, now you can skip this step, Initialize Google Play Games platform:
    var builder = new PlayGamesClientConfiguration.Builder();
    builder.EnableSavedGames();
    builder.AddOauthScope("profile");
    var config = builder.Build();
    PlayGamesPlatform.InitializeInstance(config);
    
    // Enable debug mode as needed
    PlayGamesPlatform.DebugLogEnabled = true;
    
    1. Then authenticate the User to initialize the storage:
    PlayGamesPlatform.Instance.Authenticate(SignInInteractivity.CanPromptOnce, (status) =>
    {
        if (status == SignInStatus.Success)
        {
            Debug.Log("Logged in using Google Play successfully!");
    
            // Change the storage to Google Play Saved Game Storage
            SaveSystemSettings settings = SaveSystemSettings.DefaultSettings;
            var googleStorage = (GooglePlaySavedGameStorage)StorageFactory.FromConnectionString("google-play-games://");
            settings.Storage = googleStorage;
    
            // You can update the saved game metadata information through the GooglePlaySavedGameStorage interface through the below properties
            //googleStorage.MetadataPngImage;
            //googleStorage.MetadataDescriptin;
            //googleStorage.MetadataPlayedTime;
        }
        else
        {
            Debug.LogError("Failed to login with Google Play");
            Debug.LogError(status);
        }
    });
    
    1. Now you can simlpy call the Save System API and the operations will be done on the Saved Game storage.

    Example

    You can add the example script included in the integration package to any demo scene, and then you can just try out the demo and it'll use the Google Play Games Saved Game storage. Also, consult the example script on how to login and initialize Google Play Games platform.

    Resources

    • Download Google Play Games Integration for Save System
    • Storage Syntax
    • Google Play Games Services
    • Google Play Games plugin for Unity
    • Improve this Doc
    • 0 Comments
    In This Article
    • Getting Started
    • Example
    • Resources