Page cover

Achievement Data

Like what your seeing?

Introduction

using HeathenEngineering.SteamworksIntegration;
public struct AchievementData : IEquatable<AchievementData>, 
                                IEquatable<string>, 
                                IComparable<AchievementData>, 
                                IComparable<string>

A data wrapper around Steam's concept of an Achievement. This is implicitly convertible from string expecting that string to be the "API Name" of the achievement.

AchievementData myAch = "ACH_WIN_100_GAMES";
myAch.IsAchievd = true;
myAch.Store();

Achievements are a common feature of Steam API and one of the simpler to implement. They are typically used to mark milestones or key accomplishments of the player, you can learn more in our Steam Guides.

Fields and Attributes

Name

public string Name => get;

Returns the display name of this achievement if defined.

Description

The description of this achievement if defined.

Hidden

Returns the display attribute "hidden" for this achievement.

IsAchieved

Is the achievement "unlocked" ... this can only be set if the achievement is set to allow client write. If set to GS or Trusted write only then the attempt to set it will be ignored.

UnlockTime

The time this achievement was achieved... if any, this can be null

GlobalPercent

The percentage of users who have unlocked this achievement

Methods

Unlock

The same as assigning true to the IsAcheived field.

Only used on servers, this can be used to unlock the achievement for a specific user.

ClearAchievement

The same as assigning false to the IsAcheived field.

Only used on servers, this can be used to clear / lock the achievement for a specific user.

GetAchievementStatus

Gets the status (locked/unlocked) for the given user. This is only used on server builds.

GetAchievementAndUnlockTime

Gets the unlock status and the time the user unlocked it if any. This is only used on server builds.

This uses a tuple which is a standard feature of C#, you can learn more about it here

GetIcon

Returns the icond for the user based on the user's current state. That is if the user has this achievement unlocked then the unlocked image will be returned, else if not the locked image will be returned.

Store

A simple short cut to the Stats and Achievements Store Stats and achievements. You can call this on any achievement or stat and it will commit all changes to the backend for all stats and achievements.

Last updated