Skip to content

Achievements Examples

This section provides practical examples of using Steam Achievements in Unreal Engine projects to retrieve achievement data, check unlock state, unlock achievements, and display achievement information to the player.

All examples below are shown using Blueprint nodes, with equivalent functionality available through the C++ API.


Prerequisites

Before using any Achievements-related nodes, the following conditions must be met:

  • Achievements must be created and published in Steamworks
  • AchievementID values must exactly match the identifiers defined in Steamworks

Achievement creation and configuration is managed through Steamworks and must be completed before using achievement-related functionality.


Retrieving Achievements Data

This section demonstrates how achievement data can be retrieved at runtime in order to inspect unlock state, access metadata, and drive achievement-related UI or gameplay logic.

Retrieving All Achievements

In this example, the Get All Achievements node is used to request the complete list of achievements available for the current user, including their current unlock state and associated metadata.

The request is asynchronous and returns an array of FSteamAchievement structures through the On Success callback, which can then be stored in a variable or manager for later reuse.

This approach is commonly used when building an achievements screen, initializing achievement-related UI, or when the game needs access to multiple achievement states at the same time.

In most projects, this node is called once and the retrieved data is reused throughout the session.

Retrieving a Single Achievement by ID

In this example, the Get Achievement by ID node is used to retrieve information about a specific achievement by providing its AchievementID.

On success, the node returns a single FSteamAchievement structure, which can be broken into individual fields such as display name, description, unlock state, hidden flag, and unlock time.

This approach is suitable when only one achievement needs to be queried, for example when checking or displaying the state of a specific achievement tied to a recent gameplay event.

Querying a single achievement avoids the need to process or store the full achievements list when only targeted information is required.


Unlocking an Achievement

Unlocking an achievement is straightforward and usually triggered directly by gameplay logic when a specific condition is met.

Unlocking an Achievement by ID

In this example, the Unlock Achievement node is called with a valid AchievementID once the required condition has been satisfied.

The node is asynchronous and reports the result through the On Success and On Failure callbacks.

The On Success callback is commonly used to notify the player or update UI, while the On Failure callback can be used for logging or error handling.

Calling this node multiple times with the same AchievementID is safe, as Steam ignores unlock requests for achievements that are already unlocked.

Unlocking Incremental Achievements via Stats

Incremental achievements in Steam are not unlocked directly and are instead tied to a numeric stat defined in Steamworks, which must be incremented or explicitly updated through the Stats subsystem.

In this example, the Increment Stat Int node is used to increase the value of a stat associated with an incremental achievement by a specified delta.

When the stat reaches or exceeds the threshold configured in Steamworks, Steam automatically unlocks the corresponding incremental achievement.

Alternatively, stat values can be set directly when restoring progress from a save file or synchronizing state, as long as the final value satisfies the achievement’s unlock conditions.

Incremental achievements should always be driven by stat updates, as calling Unlock Achievement directly has no effect on achievements configured as incremental in Steamworks.


Retrieving an Achievement Icon

In this example, the Get Achievement Icon node is used to request the icon texture associated with a specific achievement.

The request is asynchronous and returns a UTexture2D through the On Success callback, which can be directly assigned to UI elements such as Image widgets.

Achievement icons are loaded on demand and are not available immediately, so the result should always be handled through the callback rather than accessed synchronously.

This approach is typically used when displaying achievements in menus, popups, or notifications.


Important Notes

  • AchievementID values must exactly match those defined in Steamworks
  • Achievements must be published before they become accessible at runtime
  • Steam must be running and initialized for any achievement functionality to work