Lucky Raccoon Games
  • Start Here
  • Really Simple Steam Integration
    • Setup
    • Running Demo Scenes
    • Leaderboards
      • Setup
      • Initializing Leaderboards
      • Submitting Scores
      • Retrieving Leaderboard Data
    • Stats and Achievements
      • Setup
      • Unlocking Achievements Directly
      • Unlocking Achievements from Stats
    • Cloud Save
      • Setup
      • Saving and Loading Data
    • Friends List
      • Setup
      • Getting Friends Data
    • Drag & Drop UI Components
    • Troubleshooting
    • Useful Links
  • Really Simple Tutorials
    • Setup
    • Running Demo Scenes
    • Tutorial Screen
      • Categories
      • Items
      • Setting up the screen with your data
      • Tutorial Manager anatomy
    • Tutorial Popup
      • Showing and hiding Popups
      • Tutorial Popup anatomy
    • Integrations
      • New Input System
    • Troubleshooting
  • Support
Powered by GitBook
On this page
  1. Really Simple Steam Integration
  2. Stats and Achievements

Unlocking Achievements from Stats

PreviousUnlocking Achievements DirectlyNextCloud Save

Last updated 1 year ago

There are achievements that require the player to do some action a certain number of times to be unlocked, for example: kill 100 enemies, jump 50 times, collect 1000 coins, etc. Fortunately, Steam has a stats system that helps track the player's progress and even unlocks achievements automatically when a certain number (defined by you) is reached. For this to work, you must interact with a stat rather than directly interacting with the achievement.

Use the code below to increment a stat:

[SerializeField]
SteamAchievements steamAchievements;

steamAchievements.IncrementStat("STAT_JUMP");

You can also increment a stat in the Unity Editor by associating the SteamAchievements script with any event, as shown in the following example:

Note that STAT_JUMP corresponds to the Steamworks Stat ID:

When increasing a stat, if the amount required to unlock the achievement is reached, the achievement will be unlocked automatically.

Important: to learn more about Stats, as well as how to enable and configure it, please refer to the .

official documentation
A stat being incremented on a button click event
Stat configuration in Steamworks