🖥️
PLAY SDK Documentation
v0.13.0-dev (Obsolete)
v0.13.0-dev (Obsolete)
  • 🛠️ENVIRONMENT SETUP
    • Overview
    • PLAY Sample Package
  • 🖥️SDK Integration Guides
    • Getting Started
      • Unity
        • Tech Requirements
        • Step 1 - Import packages
        • Step 2 - Import credentials
        • Step 3 - Environments
        • Step 4 - Initialization
      • Unreal
        • Tech Requirements
        • Step 1 - Import packages
        • Step 2 - Configure credentials
        • Step 3 - Environments
        • Step 4 - Initialization
    • Authentication
      • Unity
      • Unreal
    • User Profile
      • Unity
      • Unreal
    • Virtual Items
      • Unity
      • Unreal
    • Inventory
      • Unity
      • Unreal
    • Store
      • Unity
      • Unreal
    • Currency (IAP)
      • Unity
      • Unreal
    • Achievements
      • Unity
      • Unreal
    • Game Progress
      • Unity
      • Unreal
    • Leaderboards
      • Unity
      • Unreal
    • Matchmaking
      • Unity
      • Unreal
    • Wallets
      • Unity
      • Unreal
    • Analytics
      • Unity
      • Unreal
    • Notifications
      • Unity
      • Unreal
    • Module Requests
  • 🎲Game Design Guides
    • Overview
    • User Authentication
    • User Profile
    • Game (Progression + Rewards)
    • Virtual Items
    • Currency (IAP)
    • Store
    • Inventory
    • Achievements
    • NFT Purchase Flow & Wallets
    • Limited-Time Offers
    • NFT Passes
  • 📌Links
    • PLAY Whitepaper
    • PLAY Postman API Doc
    • PLAY Dev Dashboard
    • PLAY Example Repository Dev
    • PLAY Example Repository Prod
    • API Endpoints
    • Report an Issue
    • Discord dev-chat
    • Telegram Community Channel
    • Social Links
Powered by GitBook
On this page
  • Introduction
  • Set Custom User Data
  • Get Custom User Data

Was this helpful?

Export as PDF
  1. SDK Integration Guides
  2. Game Progress

Unity

Unity integration

Introduction

In the Game Progress module, you will be able to store game specific data related to the user progression.

Set Custom User Data

You can store your custom serialized classes in our database:

using UnityEngine;
using RGN.Modules.GameProgress;

[System.Serializable]
public class CustomUserData
{
    public int HitPoints;
    public int RegenerateHealth;
    public int HealthRegenDelay;
    public int HealthRegenRate;
    public string SomeString;
    public string[] Bookmarks;
    public float Health;
}

public class GameProgressExamples : MonoBehaviour
{
    public async void StoreCustomDataAsync()
    {
        var customData = new CustomUserData()
        {
            HitPoints = 10,
            RegenerateHealth = 10,
            HealthRegenDelay = 39,
            SomeString = "Hello World",
            Bookmarks = new string[] { "bookmark_1", "bookmark_2" },
            Health = 3.14f
        };
        UpdateUserLevelResponseData<CustomUserData> customUserData = await GameProgressModule.I.UpdateUserProgressAsync(customData, null);
        Debug.Log($"Updated hit points : "+ customUserData.playerProgress.HitPoints);
    }
}

Get Custom User Data

You can get your custom serialized classes in our database:

using UnityEngine;
using RGN.Modules.GameProgress;

[System.Serializable]
public class CustomUserData
{
    public int HitPoints;
    public int RegenerateHealth;
    public int HealthRegenDelay;
    public int HealthRegenRate;
    public string SomeString;
    public string[] Bookmarks;
    public float Health;
}

public class GameProgressExamples : MonoBehaviour
{
    public async void GetCustomDataAsync()
    {
        var customUserData = await GameProgressModule.I.GetUserProgressAsync<CustomUserData>();
        Debug.Log($"Retrieved hit points : "+ customUserData.playerProgress.HitPoints);
    }
}

PreviousGame ProgressNextUnreal

Last updated 1 year ago

Was this helpful?

🖥️