This is how I setup multiple Stats
STEAMWORKS
First Setup Stats like this:
Stat Name needs to be “stat_stat”
Then Create a Leaderboard:
Leaderboard Name needs to be “stat” and Descending Numeric.
Also, it won’t show up as an actual Community Leaderboard if you leave “Community Name” blank.
Setup the Achievement that’s tied to the Stat:
Then Publish these changes!
BLUEPRINT
I recommend handling all Stats / Achievements in GameInstance so it can be accessed everywhere and isn’t abrupted by the player changing scene etc. Also the Events are Asynchronous Calls so they need to be in the Event Graph and can’t be in a Function.
Reading Stats:
In GameInstance: Event Begin I run this Event after a 1 sec Delay (to let everything initialize correctly):
I Read the current Stat values and Save them down in my Save Game so we don’t have to Read Leaderboard Integer constantly (this is because Read Leaderboard Integer takes time AND I have experienced many times that it simply fails to run On Succeed or On Failure. So we use it once every time we start the game and that’s it.
Also don’t use a Sequence for this as it will fail.
Saving Stats:
When you want to add Stats, do it Locally to your Save Game first.
(Your code will look different of course, but this is just a simple example.)
Uploading Stats:
Then it’s time to upload the Stats as follows.
Do not use a Sequence for this as it will fail, it needs to be connected as above for it to work. Also make sure you do NOT call this Event multiple times before it is complete, it is therefor best to have a specific point where it’s called once (like end of a level).
Result:
After getting some Airtime in my game, I end my turn, run the code and it Uploads to Steam as shown below. (You might need to exit the game and let Steam load for a moment before the progress shows up.)
When you hit your goal it will automatically unlock the Achievement.
Resetting Stats:
There are a few ways to reset Stats but not many good ways in Blueprint.
Step 1: In Steamworks > Leaderboards → View Scores → Delete (your entry)
That solves 1 part, but the Stat itself will not be reset in your account.
Step 2: Open Steam with Console by typing this in Run (Win+R)
A Console window will open with steam: type → reset_all_stats 480
(Where 480 is your unique AppID)
To Reset a specific Achievement type → achievement_clear 480 Achievement_Name
To Reset All Achievements from inside Unreal BP, run this:
(online.ResetAchievements)