Search Unity

  1. Get all the Unite Berlin 2018 news on the blog.
    Dismiss Notice
  2. Unity 2018.2 has arrived! Read about it here.
    Dismiss Notice
  3. We're looking for your feedback on the platforms you use and how you use them. Let us know!
    Dismiss Notice
  4. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Learn more.
    Dismiss Notice
  6. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  7. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  8. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Steam Leaderboards - Easy Steamworks Integration

Discussion in 'Assets and Asset Store' started by FreebordMAD, Jun 23, 2017.

  1. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    421
    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

    - Guts and Glory

    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.
    Code (CSharp):
    1. // show the Steam Leaderboard popup for the table 'Test'
    2. ((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.
    Code (CSharp):
    1. // upload score to Steam Leaderboards
    2. 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: https://www.assetstore.unity3d.com/en/#!/content/93354
     
    Last edited: Jul 18, 2017
  2. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    421
    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!
     
  3. csgood11

    csgood11

    Joined:
    Sep 27, 2017
    Posts:
    6
    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.
     
  4. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    421
    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:
    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:
    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/
     
  5. csgood11

    csgood11

    Joined:
    Sep 27, 2017
    Posts:
    6
    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. 1.PNG 2.PNG
     
  6. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    421
    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.
     
  7. csgood11

    csgood11

    Joined:
    Sep 27, 2017
    Posts:
    6
    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!
     
    Last edited: Oct 7, 2017
    FreebordMAD likes this.
  8. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    421
    Awesome!!!

    I have changed your scx script, see attached.
    You need to add a uGUI button to your game scene for this:
    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!!!
     

    Attached Files:

    • scx.cs
      File size:
      1.2 KB
      Views:
      113
  9. csgood11

    csgood11

    Joined:
    Sep 27, 2017
    Posts:
    6
    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?
     
  10. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    421
    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):
    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)
     
    csgood11 likes this.
  11. csgood11

    csgood11

    Joined:
    Sep 27, 2017
    Posts:
    6
    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.
     
    FreebordMAD likes this.
  12. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    421
    Simply call the code below in a Start function of a script in your static screen:
    Code (CSharp):
    1. SteamLeaderboardsUI.Instance.DownloadScores("Best Wave");
    Please keep me posted on your progress.
     
    csgood11 likes this.
  13. csgood11

    csgood11

    Joined:
    Sep 27, 2017
    Posts:
    6
    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.
     
    FreebordMAD likes this.
  14. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    421
    Great! Thank you for the review it really helps!
     
  15. thatfoolsean

    thatfoolsean

    Joined:
    Aug 20, 2012
    Posts:
    10
    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?
     
    FreebordMAD likes this.
  16. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    421
    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
     
    Last edited: Nov 28, 2017
  17. thatfoolsean

    thatfoolsean

    Joined:
    Aug 20, 2012
    Posts:
    10
    Awesome! Thanks! Buying now!
     
    FreebordMAD likes this.
  18. DigitalMistakeUA

    DigitalMistakeUA

    Joined:
    Oct 5, 2017
    Posts:
    4
    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
     
    Last edited: Nov 29, 2017
  19. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    421
    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.
     
  20. DigitalMistakeUA

    DigitalMistakeUA

    Joined:
    Oct 5, 2017
    Posts:
    4
    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))))
     
    FreebordMAD likes this.
  21. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    421
    I'm glad I could help! Please keep in mind that you should change the default sorting:
    http://www.freebord-game.com/EasySt...s_main.html#a1e3bddebf4179381d9ff7bb25a486a57

    By the way, you would help the ESI project a lot by leaving a review in the Unity Asset Store!
     
  22. ZealousAppex

    ZealousAppex

    Joined:
    May 3, 2015
    Posts:
    13
    Hi,

    I'm using this for a VR game we hope to release soon. I'm having a couple Questions:


    1. I have 100 levels, is it correct to store each person time per level like this?
    Code (CSharp):
    1. SteamLeaderboardsUI.UploadScore("Level90", TotalTime)
    If so is it possible to load all the times for one user?
    Example :
    Level: 01 Time: 00:01:58
    Level: 02 Time: 00:06:45
    est..

    2. Is it normal to have the "SteamManager" script attached to connect to steam (even if its disabled), otherwise I get a (I do integrate it "using Steamworks"):

    3. Proper way to exit program, steam seems to be holding communication after exiting the game from the editor. Whats the proper way to exit?

    Thank you for such a time saver!

    Below are solved:

    Solved: "File was not found" just run Unity as Administrator.

    Solved: This was corrected by dropping the U_My_GUI_Popup_Manager" on to the Steamleaderboard Canvas. The popup info like, error and new high score is attaching to another Canvas in my scene. (see image)


    Capture.JPG
     
    Last edited: Dec 5, 2017
  23. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    421
    Yes, this is correct. Steam allows to have up to 10k leaderboards per game.

    You can load the score of the current user with:
    Code (CSharp):
    1.  
    2.             SteamLeaderboardsMain.Instance.DownloadScoresAroundUser(m_leaderboardName, 0, (LeaderboardsDownloadedScoresEventArgs p_resultArgs) =>
    3.             {
    4.                 if (p_resultArgs.Scores.Count > 0)
    5.                 {
    6.                     Debug.Log("Level: " + p_resultArgs.LeaderboardName + " Time: " + p_resultArgs.Scores[0].Score);
    7.                 }
    8.             });
    You don't need to have the SteamManager script attached it will be instantiated on runtime. Also, it MUST be enabled to work (could be that Steamworks enables it when needed).

    If you would destroy the ESI scripts or the SteamManager, then it would close all connections. However, it should be sufficient to just use Application.Quit().
    EDIT: this works only in standalone built, there is no proper way to close a Steam connection in the Unity Editor.

    You're welcome! Seeing this in a review would help a lot!

    The "File was not found!" message comes if you are not logged in in Steam, could this be something you need to consider?
     
  24. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    421
    This is simple! Download the current score as below, then add a new value to it:
    Code (CSharp):
    1. int scoreToAdd = 10;
    2. SteamLeaderboardsMain.Instance.DownloadScoresAroundUser(m_leaderboardName, 0, (LeaderboardsDownloadedScoresEventArgs p_resultArgs) =>
    3. {
    4.     int currentScore = 0;
    5.     if (p_resultArgs.Scores.Count > 0)
    6.     {
    7.         // get current user score
    8.         currentScore = p_resultArgs.Scores[0].Score;
    9.     }
    10.     // add to current user score
    11.     currentScore += scoreToAdd;
    12.     // upload new score
    13.     SteamLeaderboardsUI.UploadScore(m_leaderboardName, currentScore, (LeaderboardsUploadedScoreEventArgs p_leaderboardArgs) =>
    14.     {
    15.         Debug.Log("Score updated in table '" + p_leaderboardArgs.LeaderboardName + "' to '" + p_leaderboardArgs.Score + "'");
    16.     });
    17. });
     
  25. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    421
    To alter the pop-up you need to change its Prefab:
    upload_2018-1-1_10-32-49.png
    The best way to do this is to drop the popup_steam_leaderboard_root Prefab on the Canvas_SteamLeaderboard object of the ExampleScenesPopup/SteamLeaderboards scene. Then change it as you need it and apply your changes:
    upload_2018-1-1_10-36-36.png
    Please don't hesitate to ask any further questions. Also, keep in mind that if you like what you have bought then you would help the whole ESI project by dropping a short review on the Unity Asset Store ;)
     
  26. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    421
    I just got asked to create a how to video for the Steam Leaderboards - Easy Steamworks Intergration working with a uGUI button:
     
  27. Neikke

    Neikke

    Joined:
    Jun 23, 2017
    Posts:
    56
    Thank you so much for creating a video Denis! This helped a lot!

    I have another question. I opened your example scene with Popup, and currently to switch between Global and Friends Scores I have to close the main window -> go to advanced -> switch to Friends or Global and press Load Scores again. Is there a way to switch Global/Friends scores without closing that window? So that only score contents change. Thanks in advance!
     
    Last edited: Jan 21, 2018
    FreebordMAD likes this.
  28. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    421
    I'm glad it helps!

    You can create two buttons like the one in the video. Make sure that both are visible when the popup is shown. Label one 'Global' and the other one 'Friends'. The global button is the one from the video. The friends button needs to call
    DownloadScoresAroundUser
    instead of DownloadScores. You can create a second script file for that.
    Code (CSharp):
    1. ((SteamLeaderboardsPopup)uMyGUI_PopupManager.Instance.ShowPopup("steam_leaderboard")).LeaderboardUI.DownloadScoresAroundUser("Test", 10);
    http://www.freebord-game.com/EasySt...ds_u_i.html#a6274dca3f877c27fc0ed92f449949a60
     
    Last edited: Jan 23, 2018
  29. Neikke

    Neikke

    Joined:
    Jun 23, 2017
    Posts:
    56
    Thanks Denis! But this would just give me a list of 10 scores of global users around my score (DownloadScoresAroundUser) They're not my friends. But how do I actually fetch my friends' scores? is it possible? Thanks for your help and patience!

    UPD: No worries, I added another onClick event on the button to switch to Global/Friends type, and on the second onClick event I'm calling downloadScores which switches nicely. Let me know if there's better/more efficient way to do this!
     
    Last edited: Jan 24, 2018
    FreebordMAD likes this.
  30. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    421
    Oh sorry that was the wrong function. :eek:

    I assume that you have found the SteamLeaderboardsMain.ScoreDownloadSource property, right?
    An alternative would be to pass the ScoreSource to the SteamLeaderboardsMain.DownloadScores method. However, for the later you should either make sure that the popup is open already or add an overloaded method SteamLeaderboardsUI.DownloadScores to pass the source type to the main class.
     
  31. Neikke

    Neikke

    Joined:
    Jun 23, 2017
    Posts:
    56
    That's how I did it, I'm first calling this method:

    Code (CSharp):
    1. public void GoGlobal()
    2.     {
    3.         SteamLeaderboardsMain.Instance.ScoreDownloadSource = ELeaderboardDataRequest.k_ELeaderboardDataRequestGlobal;
    4.     }
    and then this one:

    Code (CSharp):
    1. public void ShowPopup()
    2.     {
    3.         ((SteamLeaderboardsPopup)uMyGUI_PopupManager.Instance.ShowPopup("steam_leaderboard")).LeaderboardUI.DownloadScores("Leaderboard");
    4.     }
    Works fine so far!
     
    FreebordMAD likes this.
  32. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    421
    Great, I'm glad that it works!

    Just in case that someone else also needs to show friend scores and reads here. Do I understand right that you also have a button somewhere to switch to friends mode like this:
    Code (CSharp):
    1. public void GoFriends()
    2.     {
    3.         SteamLeaderboardsMain.Instance.ScoreDownloadSource = ELeaderboardDataRequest.k_ELeaderboardDataRequestFriends;
    4.     }
     
  33. Neikke

    Neikke

    Joined:
    Jun 23, 2017
    Posts:
    56
    Yes. Exactly! Actually I've made GoGlobal, GoFriends and even GoAroundUser methods. The more buttons - the better ;)
     
    FreebordMAD likes this.
  34. Redrag

    Redrag

    Joined:
    Apr 27, 2014
    Posts:
    101
    i'm sort of struggling at the first hurdle. how do you actually send a value? I'm getting this error:

    UploadScore: type mismatch for leaderboard 'LEADER_RACE_1500' type on Steam is 'k_ELeaderboardDisplayTypeTimeMilliSeconds', expected 'k_ELeaderboardDisplayTypeNumeric'!

    But how do you format the value passed? SteamLeaderboardsUI.UploadScore("Test", 123);

    By the way, what I want to really is send time. But the Steam display type does not seem to have this option..
     
  35. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    421
    Please take a look at SteamLeaderboardsMain.UploadScore you will find an overload method taking a ELeaderboardDisplayType parameter. You can use either ELeaderboardDisplayType.k_ELeaderboardDisplayTypeTimeSeconds or ELeaderboardDisplayType.k_ELeaderboardDisplayTypeTimeMilliSeconds to represent time leaderboards.

    The leaderboard type can be configured either through the Steam partner portal or you simply delete the leaderboard from the Steam portal and call SteamLeaderboardsMain.UploadScore with the proper ELeaderboardDisplayType. This will create a new leaderboard with the given type.

    The SteamLeaderboardsUI.UploadScore method doesn't support a type yet, but you could simply add the parameter to the code of the SteamLeaderboardsUI class and pass it over to the SteamLeaderboardsMain call.

    Please don't hesitate to ask further questions if something is still unclear and keep me posted on your progress.
     
  36. Redrag

    Redrag

    Joined:
    Apr 27, 2014
    Posts:
    101
    Here are some observations about this asset.
    1) The code is well commented but it takes a lot of time to wade through Some more documentation would save an awful lot of messing around. The documentation is inadequate for an asset of this price.
    2) Why do I have to hack your code to make things like display type and sort order work.? It means I then have to maintain that if you update your asset.
    3) In order to make this work have to have Steam client running first. (Unlike when I did achievements). Also when I changed something in Steam (sort order) I had to stop and start both Steam client and Unity to allow the changes to propagate. A heads up would have saved some frustration!
    It's sort of working now - but I came very close to ditching the whole thing.
     
    FreebordMAD likes this.
  37. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    421
    First of all, thank you very much for your valuable feedback! The ESI plugins are new and there is a lot of work needed to polish them. However, I need feedback from users like you to see what needs to be improved.

    Could you please give some examples of what is missing.

    Adding the same overloads to all UI classes as they are available in the corresponding Main classes is already on the to do list.

    You are right this is a general problem with Steam. If you change things through the portal, then it can take quite a while until it reaches your Steam client. Restarting it speeds up the progress. I will start a trouble shooting session and add this behavior there.

    Having the Steam client running first is the default behavior of Steamworks.NET. Since Steam games always run with the client started first, I didn't see a reason to change this.

    I'm sorry for the trouble you had, but glad that it works now. Is there still anything that you are not satisfied with?
     
  38. DaveBigHead

    DaveBigHead

    Joined:
    Jun 20, 2016
    Posts:
    8
    I have a strange issue and just wanted to see if you have any ideas....I have a finished game live on Steam with Steamworks integrated and working leaderboards, I have now made a demo version and included the same leaderboard code but set up a new leaderboard within the demo steam desktop and changed the appID to the demo ID. The demo works fine running in the Unity editor but when built as a standalone exe and/or uploaded to Steam and downloaded via a red dev key the leaderboards fail, it's like the callbacks aren't working. I can identify the user, the user's friends etc. but the leaderboards can't read or write. Given they work from Unity editor that suggests code etc. is all ok it's just something odd about privileges/access to the leaderboards, something is not being set/passed across when run standalone but is set/passed across when run from the Unity editor. I'm 5 days into trying to find the reason, mailed everyone I can, posted in Steam forums, etc. etc...has anyone got any idea why this might fail? Or what else I can do to debug? Getting desperate!
     
  39. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    421
    First of all, thanks for choosing the ESI plugins!

    Some brainstorming:
    • have you waited for 24h after creating the new app ID in Steam.
      Sometimes it takes ages to synchronize across all servers?
    • have you restarted your steam client?
    • have you copied the steam_appid.txt to the root of your release folder (where the .exe is)?
    • have you enabled you community Steam functions for developers?
      (Dashboard->Click You Game->Edit Steamworks Settings->Application->Steam Cloud->Enable cloud support for developers only)
    • did you create a new game or a hidden patch?
      If it is a hidden patch how did you get a new app ID, it should be the same?
      (Can you make some screenshots of the Steamworks portal?)
     
  40. Redrag

    Redrag

    Joined:
    Apr 27, 2014
    Posts:
    101
    Could you let me know what happens if the upload to Steam leaderboards fail? I'm guessing there is nothing built in to handle this so I am writing something that holds results locally then uploads until there is success (which means multiple scores could be sent at once). To do so I guess I need to send an Action to UploadScore. But I need to add an argument so that I know which particular score has successfully uploaded. Could you let me know the best way of doing this?

    Re. earlier comment about documentation, why not add some of what you have in the forum into the documentation as a starting point?

    Thanks.
     
  41. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    421
    Just wanted to ask if you were able to solve this?

    Yes, you are right you need to implement a cache yourself. Through, this is a good feature idea!

    Currently, there is an issue with sending multiple scores within the same update cycle. Therefore, the best way would be to upload the scores one by one and wait 5 seconds between each upload. You don't need to add an argument to the action, just make it a lambda action "() => {...}" and reference your score entry there from the outter method scope.

    That's exactly the plan. I will create a trouble shooting section from all the messages, mails and this thread and write how tos with videos for the faq.
     
  42. Redrag

    Redrag

    Joined:
    Apr 27, 2014
    Posts:
    101
    Hi - it doesn't seem to like that - have I misunderstood?

    upload_2018-4-13_16-8-30.png
     
  43. auroxi

    auroxi

    Joined:
    Dec 31, 2012
    Posts:
    81
    I have seen an issue here. If I submit a score for a new leaderboard in the example scene and keep submitting better scores, it works every time....however if I go into steam admin and Delete the score from the leaderboard...it breaks forever and it places a "1" next to submitted scores, but never actually shows you any when you "View scores".

    I have also noticed that if I quit Steam and Unity, the asset then decides to work again after a score has been deleted?

    Need a fix please :)

    Also, the popup_text_root GameObject appears to be created before popup_steam_leaderboard_root at times. I've had to create a separate canvas just for the popup to ensure it is in front of the leaderboard object.
     
    Last edited: Apr 13, 2018
  44. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    421
    Example cache score uploader:
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using System.Collections.Generic;
    4.  
    5. using LapinerTools.Steam;
    6. using LapinerTools.Steam.Data;
    7.  
    8. public class ExampleScoreCacheUpload : MonoBehaviour
    9. {
    10.     public List<KeyValuePair<string, int>> ScoresToUpload = new List<KeyValuePair<string, int>>();
    11.  
    12.     private float m_nextUploadTime = 0;
    13.  
    14.     private void Start()
    15.     {
    16.         ScoresToUpload.Add(new KeyValuePair<string, int>("TestScores", 10));
    17.         ScoresToUpload.Add(new KeyValuePair<string, int>("TestScores", 20));
    18.         ScoresToUpload.Add(new KeyValuePair<string, int>("TestScores", 30));
    19.         ScoresToUpload.Add(new KeyValuePair<string, int>("TestScores", 40));
    20.     }
    21.    
    22.     private void Update()
    23.     {
    24.         if (m_nextUploadTime < Time.realtimeSinceStartup && ScoresToUpload.Count > 0)
    25.         {
    26.             m_nextUploadTime = Time.realtimeSinceStartup + 5;
    27.  
    28.  
    29.             var scoreToUpload = ScoresToUpload[0];
    30.             SteamLeaderboardsMain.Instance.UploadScore(scoreToUpload.Key, scoreToUpload.Value, (LeaderboardsUploadedScoreEventArgs args) =>
    31.             {
    32.                 if (!args.IsError && ScoresToUpload.Count > 0)
    33.                 {
    34.                     ScoresToUpload.RemoveAt(0);
    35.                 }
    36.             });
    37.         }
    38.     }
    39. }
     

    Attached Files:

  45. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    421
    By deleting it in the Steam admin you bring the Steam client out of sync, this is more or less a normal behavior. In the normal workflow you will not delete scores through the partner portal at all or if you do so, then you will not care about the "bad" users whos scores you have deleted.

    This should not be the case, please check if you have the latest version. Alternatively, please check that you uMyGUI_Popup class includes the below code.
    Code (CSharp):
    1.         public virtual void Show()
    2.         {
    3.             gameObject.transform.SetAsLastSibling(); // bring to front
    4.             gameObject.SetActive(true);
    5.  
    6.             if (OnShow != null) { OnShow(); }
    7.         }
     
  46. Autcru

    Autcru

    Joined:
    Apr 10, 2014
    Posts:
    2
    I just got this asset yet I cannot figure out how to get rid of this error

    Assets/Plugins/Steamworks.NET/CallbackDispatcher.cs(21,0): error CS1029: #error: 'You need to define STEAMWORKS_WIN, or STEAMWORKS_LIN_OSX. Refer to the readme for more details.'

    I have already tried putting WINDOWS_BUILD in the Scripting Define Symbols*
     
  47. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    421
    Thanks fur purchasing the ESI plugin!

    Which platform have you selected (Steam works with Windows Standalone)?

    Which Unity version do you have?

    See below code in CallbackDispatcher class for details:
    Code (CSharp):
    1.  
    2. #if UNITY_3_5 || UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5 || UNITY_4_6
    3.     #error Unsupported Unity platform. Steamworks.NET requires Unity 4.7 or higher.
    4. #elif UNITY_4_7 || UNITY_5 || UNITY_2017_1_OR_NEWER
    5.     #if UNITY_EDITOR_WIN || (UNITY_STANDALONE_WIN && !UNITY_EDITOR)
    6.         #define WINDOWS_BUILD
    7.     #endif
    8. #elif STEAMWORKS_WIN
    9.     #define WINDOWS_BUILD
    10. #elif STEAMWORKS_LIN_OSX
    11.     // So that we don't trigger the else.
    12. #else
    13.     #error You need to define STEAMWORKS_WIN, or STEAMWORKS_LIN_OSX. Refer to the readme for more details.
    14. #endif
    15.  
    16. // Unity 32bit Mono on Windows crashes with ThisCall/Cdecl for some reason, StdCall without the 'this' ptr is the only thing that works..?
    17. #if (UNITY_EDITOR_WIN && !UNITY_EDITOR_64) || (!UNITY_EDITOR && UNITY_STANDALONE_WIN && !UNITY_64)
    18.     #define STDCALL
    19. #elif STEAMWORKS_WIN
    20.     #define THISCALL
    21. #endif
    22.  
    23.  
     
  48. Autcru

    Autcru

    Joined:
    Apr 10, 2014
    Posts:
    2
    The platform is Windows Standalone

    I am using unity 2017.3.1f1

    thank you
     
  49. monoRAIL

    monoRAIL

    Joined:
    May 22, 2010
    Posts:
    3
    That part is missing from the CallbackDispatcher file that's included in the asset.

    I also get errors in uMyGUI_TreeBrwoser.cs:

    Code (csharp):
    1. Assets/LapinerTools/uMyGUI/Scripts/uMyGUI_TreeBrowser.cs(439,16): error CS0619: `UnityEngine.EventSystems.EventTrigger.delegates' is obsolete: `Please use triggers instead (UnityUpgradable) -> triggers'
    Same error on line 441 and 443.
     
  50. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    421
    Sorry to the inconvenience caused to both of you, while I have found and fixed that half a year ago, it seems that I missed to upload the updates to the store... You will receive the new packages via PM in a few minutes

    https://forum.unity.com/threads/steam-leaderboards-easy-steamworks-integration.479183/#post-3244859