Playgama
  • Welcome
  • 🚀Quick start
  • Submitting a game
  • Game Requirments
    • 💥Self-check
    • Technical Requirements
    • Advertising Requirements
    • User Experience Requirements
    • Content Requirements
    • Other Requirements
    • Platform-Specific Requirements
  • In-Game Purchases
    • Step-by-step IAP integration guide for Unity
  • FAQ
    • General
    • Submitting a Game
    • Game Moderation
    • Payments and Statistics
  • SDK
    • Getting started
    • Engines
      • Core (Plain JS)
        • 💥Intro
        • Setup
        • Platform Parameters
        • User Data
        • Advertising
          • Banner
          • Interstitial
          • Rewarded
          • AdBlock
        • User Parameters
        • Social Interactions
        • Leaderboards
        • Achievements
        • In-Game Purchases
        • Remote Configuration
      • Unity
        • 💥Intro
        • Setup
        • Platform Parameters
        • User Data
        • Advertising
          • Banner
          • Interstitial
          • Rewarded
          • AdBlock
        • User Parameters
        • Social Interactions
        • Leaderboards
        • Achievements
        • In-Game Purchases
        • Remote Configuration
      • Construct 3
        • 💥Intro
        • Setup
        • Platform Parameters
        • User Data
        • Advertising
          • Banner
          • Interstitial
          • Rewarded
          • AdBlock
        • User Parameters
        • Social Interactions
        • Leaderboards
        • Achievements
        • In-Game Purchases
        • Remote Configuration
      • GDevelop
        • 💥Intro
        • Setup
        • Platform Parameters
        • User Data
        • Advertising
          • Banner
          • Interstitial
          • Rewarded
          • AdBlock
        • User Parameters
        • Social Interactions
        • Leaderboards
        • Achievements
        • In-Game Purchases
        • Remote Configuration
      • Godot
        • 💥Intro
        • Setup
        • Platform Parameters
        • User Data
        • Advertising
          • Banner
          • Interstitial
          • Rewarded
          • AdBlock
        • User Parameters
        • Social Interactions
        • Leaderboards
        • Achievements
        • In-Game Purchases
        • Remote Configuration
      • Game Maker
        • 💥Intro
        • Setup
        • Platform Parameters
        • User Data
        • Advertising
          • Banner
          • Interstitial
          • Rewarded
          • AdBlock
        • User Parameters
        • Social Interactions
        • Leaderboards
        • Achievements
        • In-Game Purchases
        • Remote Configuration
      • Defold
        • 💥Intro
        • Setup
        • Platform Parameters
        • User Data
        • Advertising
          • Banner
          • Interstitial
          • Rewarded
          • AdBlock
        • User Parameters
        • Social Interactions
        • Leaderboards
        • Achievements
        • In-Game Purchases
        • Remote Configuration
    • Changelog
  • For Partners
    • Getting Started
    • Embed the Widget
      • Adding Games Widget to Your WordPress Site
      • Adding Games Widget to Your Tilda Site
      • Adding Games Widget to Your Framer Site
    • Import the Game Catalog
    • Share your referral link
Powered by GitBook
On this page
  1. SDK
  2. Engines
  3. Unity

Achievements

Achievements in HTML5 games are an exciting and rewarding feature that adds an extra layer of engagement for players. They serve as milestones, celebrating a player's progress, skill, and dedication.

Support

Use this to determine if you can implement achievements for your game on the current platform.

Bridge.achievements.isSupported

Check if getting list of achievements is supported.

Bridge.achievements.isGetListSupported

Check if built-in popup is supported.

Bridge.payments.isNativePopupSupported

Unlock achievement

Unlocks achievement for a player.

private void Start()
{
    var options = new Dictionary<string, object>();

    switch (Bridge.platform.id)
    {
        case "y8":
            options.Add("achievement", "ACHIEVEMENT_NAME");
            options.Add("achievementkey", "ACHIEVEMENT_KEY");
            break;
        case "lagged":
            options.Add("achievement", "ACHIEVEMENT_ID");
            break;
    }

    Bridge.achievements.Unlock(options, OnAchievementsUnlockCompleted);
}

private void OnAchievementsUnlockCompleted(bool success, Dictionary<string, string> result)
{
    Debug.Log(success);
}

Get List

Returns the achievement list in JSON

private void Start()
{
    Bridge.achievements.GetList(OnGetListCompleted);
}

private void OnGetListCompleted(bool success, List<Dictionary<string, string>> list)
{
    Debug.Log($"OnGetListCompleted, success: {success}, items:");
                
    if (success)
    {
        switch (Bridge.platform.id)
        {
             case "y8":
                 foreach (var item in list)
                 {
                     Debug.Log("achievementid:" + item["achievementid"]);
                     Debug.Log("achievement:" + item["achievement"]);
                     Debug.Log("achievementkey:" + item["achievementkey"]);
                     Debug.Log("description:" + item["description"]);
                     Debug.Log("icon:" + item["icon"]);
                     Debug.Log("difficulty:" + item["difficulty"]);
                     Debug.Log("secret:" + item["secret"]);
                     Debug.Log("awarded:" + item["awarded"]);
                     Debug.Log("game:" + item["game"]);
                     Debug.Log("link:" + item["link"]);
                     Debug.Log("playerid:" + item["playerid"]);
                     Debug.Log("playername:" + item["playername"]);
                     Debug.Log("lastupdated:" + item["lastupdated"]);
                     Debug.Log("date:" + item["date"]);
                     Debug.Log("rdate:" + item["rdate"]);
                 }
                 break;
        }
    }
}

Show Native Popup

Some platforms support built-in achievement list which is shown in overlay

private void Start()
{
    Bridge.achievements.ShowNativePopup(options, (success) =>
    {
        Debug.Log($"OnShowNativePopupCompleted, success: {success}");
    });
}

PreviousLeaderboardsNextIn-Game Purchases

Last updated 5 months ago