Last updated
Last updated
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:
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 .