Steam Leaderboards - Easy Steamworks Integration

Steam Leaderboards - Easy Steamworks Integration get it from the Unity Asset Store

As some of you know the Steamworks API is a complex thing. Hence, I want to create a super easy Steam integration that can be used by designers who will only need to drag n’ drop a prefab into the scene. I want to minimize the coding part as much as possible.

I’m still searching for Steam features that you developers need to work in an easy way. Therefore, feel free to say what you need for your projects!

Description

The Easy Steamworks Integration brings various Steam features to your game with a very few clicks. The Steam Leaderboards plugin allows to load, sort and filter Steam Leaderboards; scores can be enriched with additional data (like replays/screenshots). You can integrate this plugin within your uGUI menus or trigger a popup leaderboard with a single line of code. The UI is highly customizable and can be adapted to the look of your game.

Features:

  • single prefab drag n’ drop for static UI
  • single code line for popup UI
  • highly customizable uGUI prefabs
  • display leaderboards
  • filter leaderboard entries (range, around user, friends)
  • load Steam avatar textures
  • submit scores
  • format scores (numeric, seconds, milliseconds)
  • add additional data (replays, screenshots)
  • create leaderboards (rank order, display type, update type)

Screenshots



Game using the Steam Workshop - Easy Steamworks Integration

Documentation
Getting Started
Link App
Show Independent Popups
Add To Existing uGUI
Scripting Reference

Getting Started
After importing the Unity package the leaderboards examples (in ExampleScenesPopup or ExampleScenesStatic folders) will work out of the box - Steam must be running.
By default Steamworks.NET will use the Steam AppId 480 - SpaceWar, use it for your leaderboards integration tests.
Please follow the instructions in Link App to view and submit highscores to the leaderboards of your game.

Link App
Follow the steps below to set the AppId.

  • Start one of the test scenes to generate the steam_appid.txt file in the root of your project (the folder where Assets, Library and ProjectSettings directories a located).
  • Open the steam_appid.txt file and replace 480 with your Steam AppId.
  • Restart Unity Editor to load your new AppId.
  • Now you should be able to view and submit highscores to the leaderboards of your game by using the provided example scenes (in the ExampleScenesPopup or ExampleScenesStatic folders).

Show Independent Popups
The single code line below will show a leaderboard popup for the table named ‘Test’. Please find detailed example code in addition with some other useful hints in the SteamLeaderboardsExamplePopup and SteamLeaderboardsExampleAdvancedSettings classes.

// show the Steam Leaderboard popup for the table 'Test'
((SteamLeaderboardsPopup)uMyGUI_PopupManager.Instance.ShowPopup("steam_leaderboard")).LeaderboardUI.DownloadScores("Test");

The single code line below will upload the score value 123 to the table named ‘Test’. If the user has improved his recod, then a popup showing his current score, global rank and rank change will be shown. Please find detailed example code in addition with some other useful hints in the SteamLeaderboardsExamplePopup and SteamLeaderboardsExampleAdvancedSettings classes.

// upload score to Steam Leaderboards
SteamLeaderboardsUI.UploadScore("Test", 123);

Add To Existing uGUI
You will find the SteamLeaderboard prefab included in the package. All you need to do is simply drag n’ drop it into your Canvas or add it to any of your UI elements.

Powered by Steamworks.NET
Steamworks.NET created by Riley Labrecquea. If you are lucky enough to earn some money with your game, then please consider a donation to Riley Labrecquea here.

Unity Asset Store: Unity Asset Store - The Best Assets for Game Making

Steam Leaderboards, the second Unity plugin of the Easy Steamworks Integration series, is now available on the Unity Asset Store! Steam Leaderboards can be incorporated into an existing game by writing a single line of code or drag & dropping a prefab. Besides, it is super easy to customize the UI if required. Check it out on the Unity Asset Store.

Next on the roadmap is Steam Inventory. If you need something Steam related, then please don’t hesitate to contact me! I’m trying to launch the one and only easy to use Steam API and I cannot do this without customer feedback and requests!

Hi Denis,
I just loaded your score scene and it seemed to work the first time. However, when I beat my original score, the leaderboard would not update. I know that its not a problem with the score itself because I made a text that displays that variable and it seemed to update just fine. The leaderboard main code may be misplaced or something but I am very unsure. If you could take a look and possibly figure out what is preventing it from getting the new score which was greater than the previous, that would be amazing.

As you have written in your quote below via mail, Steamworks.NET seems to have a problem.
Please send me a screenshot of your console after running the Game scene for a few minutes (or just upload the Editor log file). That is what it should look like:
3243715--249425--upload_2017-10-5_7-9-41.png

As you can see here, the error message is coming from Steamworks.NET not being able to recognize your Unity version. I might need to update Steamworks.NET in my package, but to be on the safe side, please first tell me the exact Unity version that you are using.

Alternative solution would be to add WINDOWS_BUILD like this:
3243715--249426--upload_2017-10-5_7-14-11.png

You can also try to update yourself by downloading the Unity package here:
http://steamworks.github.io/installation/

Hello, I deleted the #else statement and the error in the script which fixed my issue with that. It seemed to be the only solution because I tried defining the symbol and that didnt work. I am using unity 5, or version 2017.1.0f3. I already had steamworks sdk on my project before downloading your asset and I am sure that it is the newest version. Your scripts and everything work fine. The info score itself is updating to the score every time. My only problem now is that your leaderboard will not update. I reset all the stats and it properly recorded my first score. However when I get a new score it will not update. It just stays the same as my original score. It may just be your leaderboard asset, or as you said the SDK, However am unsure, as I am unfamiliar to c#. If you could take a look again that would be great. Thank you for your time and quick responses. I really appreciate it and hope we can solve this issue soon.3244677--249564--1.PNG 3244677--249565--2.PNG

By installing my package Steamworks.NET was downgraded to 9.1.0, please download and import the newest Steamworks.NET version 10.0.0 as it is compatible with my asset and Unity 2017.1.0f3:
https://github.com/rlabrecque/Steamworks.NET/releases
If you have not created the Best Wave leaderboard yourself in the Steam control panel webpage, then this might already fix the problem. If you have created it yourself then please read below.

Could it be that the sorting of the Best Wave leaderboard is set to ascending on the Steam Webpage?
Please try to delete Best Wave leaderboard from the Steam webpage instead of clearing the scores in it.
The ESI Leaderboards package will create a new table using ELeaderboardSortMethod.k_ELeaderboardSortMethodDescending as default sorting.

Please keep me posted on your progress.

That must have been it! I set the Bestwave leaderboard to descending in steamworks and it seemed to be working! Just one last quick question, how could I make it so the popup is overlapping and activated on button press in the ui, rather than in an individual scene. If it is possible to do that, could you possible reply with a script that does that.

Besides that, its all working and thank you so much for your help and ill be leaving you a review soon. If you would like to see your leader board asset in my game, it will be available on October 16. Here is a link: http://store.steampowered.com/app/717820/Boom_Island/ . Feel free to use any of the modified or original scripts to help others in the future. Thanks again!

1 Like

Awesome!!!

I have changed your scx script, see attached.
You need to add a uGUI button to your game scene for this:
3245990--249708--upload_2017-10-7_8-54-53.png

That would help me a lot!

You’re welcome! Can’t wait to see it live on Steam!!!

3245990–249707–scx.cs (1.23 KB)

Hi Denis,
I used your script and it worked, however when I press the red “X” it would not close. This is not just for the popup button, its also when applied to any other scene. The leaderboard will not destroy when the scene changes too. Do you happen to know what is causing this problem?

Please provide a Unity Editor log generated after trying to close the popup.
Also, please provide the scripts opening the popup.

Does this happen in the example scenes that I have provided?
Please check if your popup’s close button is correctly configured (please provide a screenshot if it differs from below):
3248113--249949--upload_2017-10-9_21-37-43.png

I see two reasons for this to happen:

  1. You have set your Canvas to Don’t Destroy On Load
  2. Your script is opening the popup again and again (close button works, but popup is instantly reopened)
1 Like

Hi,
Sorry for the late reply

What was causing the popup to not close was my canvas was set to do not destroy in the menu. However id like to keep the don’t destroy on load for my canvas on that scene because it contains a pause menu and other things necessary for my game. So ive decided to not have the popup in my menu scene and made a button directing to a scene which had that script and did destroy the canvas on load. But when I hit the return to menu button (which I created) , the leaderboard remains on the menu scene, and when it does that, the x button becomes obsolete and stays with all scenes. I also dont want there to be a red X button which would be unnecessary because its not a popup now, its my scene.

As I see it, it would make most sense to have a static scene load the scores rather than a popup script. I loaded up the example static scene and disabled the example scripts because I dont want the user to be able to pick their score. However, when you load up the scene, it doesn’t automatically load those scores (like the popup one does) You have to manually input it which I dont want. Basically my question is, how do you automatically load the scores, (much like the popupscript you made did) , but in a static setting.

Thanks.

1 Like

Simply call the code below in a Start function of a script in your static screen:

SteamLeaderboardsUI.Instance.DownloadScores("Best Wave");

Please keep me posted on your progress.

1 Like

Hi,
I created that script in a static scene along with the menu button and it worked great. Exactly how I wanted it to. Thanks again for all the help.

1 Like

Great! Thank you for the review it really helps!

Hi! This might be a stupid question, but will adding this Asset also integrate the Steamworks SDK? That is to say, will I be able to upload my game to Steam without writing any additional code?

1 Like

There are no stupid questions only stupid answers. The ESI packages will also install the Steamworks.NET SDK, which will install the Steamworks C++ SDK. Hence, you will be able to upload your game to Steam after following the installation guide:

http://www.freebord-game.com/index.php/steam-leaderboards-easy-steamworks-integration#doc

Awesome! Thanks! Buying now!

1 Like

Hello, i have a problem like my score doesnt update, my first score write to table, and after i cant update a score, what i need to fix this problem? In Unity editor all is fine! but when i loaded on Valve servers, and play from steam in beta, i cant update my score

Thanks for choosing the ESI Leaderboards! Have you tried to change the sort order (descending/ascending) of your Leaderboard in the Steam Partner Portal?
Please don’t hesitate to come back if the above doesn’t help!
If it helps, then you should also change the sorting in your code.

BIG THX U Have you tried to change the sort order (descending/ascending) of your Leaderboard in the Steam Partner Portal? this is help for me))))

1 Like