Search Unity

  1. We are migrating the Unity Forums to Unity Discussions by the end of July. Read our announcement for more information and let us know if you have any questions.
    Dismiss Notice
  2. Dismiss Notice

Steam Leaderboards - Easy Steamworks Integration

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

  1. Chrisv007

    Chrisv007

    Joined:
    Jul 24, 2017
    Posts:
    26
    Hi, Any idea on how I can set the focus on a certain button after the user presses ok? Basically right after a high score a OK button appears. My game uses a controller and I need to set the focus on another button after that "ok". I can't seem to find that panel anywhere to edit it.

    Thanks
     
  2. Chrisv007

    Chrisv007

    Joined:
    Jul 24, 2017
    Posts:
    26

    Hi,

    I found the script uMyGUI_PopupManager but can't find the method called when pressing the ok button. Is it in that script? I got to that script from SteamLeaderboardsUI. I would realy appreciate your help on this one. At the moment, it's the only spot in the game that requires a mouse. I really need to set the focus on another button once the OK button is pressed. I've been going at this for 2 days.

    Thanks
     
  3. SoulGameStudio

    SoulGameStudio

    Joined:
    Jan 18, 2016
    Posts:
    46
    Hello there,

    I have a weird behavior where the callback from UploadScore seems to be called several times. I have this simple function:
    Code (CSharp):
    1. static void upload (int value, string id) {
    2.    Debug.Log("Try upload " + id);
    3.    SteamLeaderboardsMain.Instance.UploadScore(id, value, ELeaderboardSortMethod.k_ELeaderboardSortMethodAscending, ELeaderboardDisplayType.k_ELeaderboardDisplayTypeNumeric,
    4.        (LeaderboardsUploadedScoreEventArgs e) => {
    5.            Debug.Log(e.IsError ? e.ErrorMessage : e.Score + " uploaded!");
    6.        }
    7.    );
    8. }
    And here is the log. As you can see the upload function is only called 3 times in a row, but some callback are called several time! The first callback seems to be triggered by subsequent call of the upload function as well, as if an event suscription wasn't removed properly. Note that this doesn't stack up exponentially. It seems to only happen for upload calls on the same frame.

    Capture.PNG
     
  4. Chrisv007

    Chrisv007

    Joined:
    Jul 24, 2017
    Posts:
    26
    Anyone?
     
  5. Chrisv007

    Chrisv007

    Joined:
    Jul 24, 2017
    Posts:
    26
    Maybe my post was not clear enough because i'm not getting any answers so I found this piece of code that shows the OK button after a high score has been achieved:

    Code (CSharp):
    1. // player has made a new record -> show a new record popup
    2.                     if (p_leaderboardArgs.IsScoreChanged)
    3.                     {
    4.                         string statusText = "Score: " + p_leaderboardArgs.ScoreString;
    5.                         statusText += "\nGlobal Rank: " + p_leaderboardArgs.GlobalRankNew;
    6.                         int rankDif = p_leaderboardArgs.GlobalRankNew - p_leaderboardArgs.GlobalRankPrevious;
    7.                         if (rankDif != 0 && p_leaderboardArgs.GlobalRankPrevious > 0)
    8.                         {
    9.                             statusText += " (";
    10.                             statusText += rankDif < 0 ? "<color=green>" : "<color=red>";
    11.                             statusText += (p_leaderboardArgs.GlobalRankPrevious - p_leaderboardArgs.GlobalRankNew).ToString("+#;-#;0") + "</color>";
    12.                             statusText += ")";
    13.                         }
    14.                         ((uMyGUI_PopupText)uMyGUI_PopupManager.Instance.ShowPopup(uMyGUI_PopupManager.POPUP_TEXT))
    15.                             .SetText("New Record", statusText)
    16.                             [B].ShowButton(uMyGUI_PopupManager.BTN_OK);[/B]
    17.                     }
    What I need to do is set the focus on another button in my UI after this OK button is pressed. My game uses a controller so this is really important. What script do I need to edit? Where is the script or method used when pressing this OK button? I've been running after an answer for a week now. If I don't get one soon, i'll be removing this asset from my game.Getting pretty annoyed not getting any answer on this simple question.
     
  6. Raindawg

    Raindawg

    Joined:
    Apr 27, 2014
    Posts:
    2
    Just bought and imported this asset and got 31 angry red errors. (19 of them in the SteamLeaderboardsMain.cs script under LapinerTools, 1 in SteamManager.cs, and the rest in 2 of my previous scripts)

    I have Facepunch.Steamworks installed already and the addition of Steamworks.NET seems to be causing a lot of confusion with my existing scripts and the new ones.

    The errors all go along these lines:
    Code (CSharp):
    1.  
    2. Assets\Scripts\SteamCode.cs(12,13): error CS0433: The type 'SteamClient' exists in both 'Assembly-CSharp-firstpass, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' and 'Facepunch.Steamworks.Win64, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
    3.  
    4. Assets\LapinerTools\Steam\Leaderboards\Scripts\SteamLeaderboardsMain.cs(265,38): error CS0433: The type 'SteamUserStats' exists in both 'Assembly-CSharp-firstpass, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' and 'Facepunch.Steamworks.Win64, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
    Not sure what the best approach is here. Should I remove Facepunch before integrating this? I guess Steamworks.NET does basically the same things? Or can I make them play along? Will swapping Facepunch for Steamworks.NET mess anything up, my game is already in beta testing phase on Steam.
     
  7. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    633
    Just make a project backup, remove Facepunch and try. According to the errors you have reported it looks incompatible.
     
  8. Raindawg

    Raindawg

    Joined:
    Apr 27, 2014
    Posts:
    2
    Yup, that worked!

    For anyone else changing from Facepunch to Steamworks.NET, this is what I did:
    1. Removed Facepunch files under Plugins
    2. Changed these values in my current scipts:
    SteamClient.SteamId > SteamUser.GetSteamID()
    SteamClient.AppId > SteamApps.GetAppBuildId()

    I think that was pretty much it.
     
    FreebordMAD likes this.
  9. hollysephiroth

    hollysephiroth

    Joined:
    Mar 25, 2014
    Posts:
    19
    Hello , Im trying to use this addon but as soon as I build game I get this errors
    A scripted object (script unknown or not yet loaded) has a different serialization layout when loading. (Read 44 bytes but expected 25716 bytes)
    Did you #ifdef UNITY_EDITOR a section of your serialized properties in any of your scripts?

    They only appear if I use steam leaderbords element if I disable it all is fine
     
  10. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    633
    Hi and thanks for trying the ESI plugin.

    From your log I see that the follow up error is "The referenced script (Unknown) on this Behaviour is missing!".
    Therefore, you should be able to see something not working. Does the Leaderboard show?

    You have a modified "SteamLeaderboardsExampleStatic" script the .cs file still has the name "SteamLeaderboardsExampleStatic" right?

    Which Unity version are you on?
    Does it happen if you just try to build the plugin compiled in an emopty project?

    P.S.: the name of your game sounds interesting, is there any material to check out ;)
     
    gliealonso likes this.
  11. monoRAIL

    monoRAIL

    Joined:
    May 22, 2010
    Posts:
    9
    I'm getting a crash when I build my game with steam leaderboards enabled:

    Code (CSharp):
    1.  
    2. Plugins: Failed to load 'D:/Documents/Projects/Mars_Flight_VR/Builds/Mars Flight VR/Mars Flight VR_Data/Plugins/CSteamworks.dll' because one or more of its dependencies could not be loaded.
    3. (Filename: C:\buildslave\unity\build\Runtime/Misc/Plugins.cpp Line: 268)
    4.  
    5. Fallback handler could not load library D:/Documents/Projects/Mars_Flight_VR/Builds/Mars Flight VR/Mars Flight VR_Data/Mono/CSteamworks
    6. Fallback handler could not load library D:/Documents/Projects/Mars_Flight_VR/Builds/Mars Flight VR/Mars Flight VR_Data/Mono/CSteamworks.dll
    7. Fallback handler could not load library D:/Documents/Projects/Mars_Flight_VR/Builds/Mars Flight VR/Mars Flight VR_Data/Mono/CSteamworks
    8. Fallback handler could not load library D:/Documents/Projects/Mars_Flight_VR/Builds/Mars Flight VR/Mars Flight VR_Data/Mono/libCSteamworks
    9. Fallback handler could not load library D:/Documents/Projects/Mars_Flight_VR/Builds/Mars Flight VR/Mars Flight VR_Data/Mono/libCSteamworks.dll
    10. Fallback handler could not load library D:/Documents/Projects/Mars_Flight_VR/Builds/Mars Flight VR/Mars Flight VR_Data/Mono/libCSteamworks
    11. Plugins: Failed to load 'D:/Documents/Projects/Mars_Flight_VR/Builds/Mars Flight VR/Mars Flight VR_Data/Plugins/CSteamworks.dll' because one or more of its dependencies could not be loaded.
    12.  
    Unity 2019.2.11f1

    The game runs fine from the editor, but crashes when I load a scene with the steamManager in a built version. This error also appears in the player.log when I load the game with steam disabled, but the game doesn't crash.
     
  12. monoRAIL

    monoRAIL

    Joined:
    May 22, 2010
    Posts:
    9
    Solved - I had to manually copy steam_api.dll, steam_api64.dll and steam_appid.txt into the build root folder to get it to work. Should these have been placed by Unity during the build or does this always have to be done manually?

    Surely the steam_appid.txt file shouldn't be needed in a final build?
     
  13. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    633
    Hi and sorry for the late reply. You could try to reinstall the newest Steamworks.NET version, this might solve the issue. Usually all DLLs are moved and it should work out of the box.

    steam_appid.txt is required only if the game is lunched via the .exe file and not steam, which usually will never be the case.
     
  14. gliealonso

    gliealonso

    Joined:
    Oct 21, 2018
    Posts:
    118
    Hi,

    Is there a way to redownload the data from the LeaderBoard?

    I'm having an issue that everytime I play my game then return to the Menu, when I change characters, the Leaderboard doesn't update according to the character selected(even if no data was uploaded to any leaderboard during the game).

    In this example, I made the game print the current name of the leaderboard that was supposed to appear according to the character selected(in which I currently had Matsumoto selected) after I played a round(with the other character called Fynis) and went back to the menu(no data was uploaded), but as you can see on the screen, the wrong leaderboard is appearing, even after I disable and enable the gameobject containing the leaderboard, it continues happening.
    upload_2020-5-11_18-2-38.png
    upload_2020-5-11_18-5-6.png

    Is there anyway to reset/refresh the leaderboard?

    Many thanks,
    Gabriel.
     

    Attached Files:

  15. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    633
    I'm very sorry for the late reply. It looks like you have the leader boards twice in your scene, this was not yet intended to work. Possible would be to use the same screen, but have two buttons like tabs. If you click on the buttons, then you can jump between top 10 and user score. I hope it helped?
     
    gliealonso likes this.
  16. gliealonso

    gliealonso

    Joined:
    Oct 21, 2018
    Posts:
    118

    Ohhh! Ok, now I know why it wasn't working. It's no worries then.

    Can I per example, only leave one activate at a time?
     
  17. devotid

    devotid

    Joined:
    Nov 14, 2011
    Posts:
    445
    Im kind of working on the same thing and having troubles for The Coin Games new Leaderboards.

    I would like to show "Friends" Leaderboards, "Global" overall and "Around me" all at the same time in three different Panels but I dont know how to identify each Instance of SteamleaderboardsUI. I know how to get the different data from the SteamLeaderboardsMain but they all fill in the same data as I dont know how to "send" the data to each Steamleaderboard prefab in the scene. Is this possible?

    Thanks

    Kevin
     
  18. devotid

    devotid

    Joined:
    Nov 14, 2011
    Posts:
    445
    Ok I just went with your suggestion to gliealonso above... I used a tab system and only view one at a time. Who needs to read three menus at once anyway? lol. Done.

    Next problem.

    Is there a way to limit the amount of friends when I download and sort them as Friends only? Right now it downloads ALL of my friends instead of the set amount like it does on AroundMe.

    Thanks again.
    Hope you are well.
     
  19. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    633
    Guys @gliealonso, @devotid sorry for the lack of support here. I hope the tab workaround works so far for both of you. Actually, the version 1.25 already supports requesting multiple leader boards even in the same frame, but I just couldn't fully finish the development here now not having enough time to do so...

    What exactly is the problem with downloading all friends? In the end this is a list with usually less than 1000 entries. For friends the images are not requested if there is no score entry downloaded for the friend. By the way you can round DownloadScoresAroundUser with ScoreDownloadSource set to Friends.



    General Announcement
    Hi everybody, I'm sorry to say but in the current worldwide and my private situation I struggle to find time to provide support. None of my projects is discontinued and I will upgrade all of my projects to the newest Unity version. I assume that the support issue will continue till around Christmas, then it pretty much depends on corona or kindergartens being open/closed. I'm very sorry for the inconvenience this causes at the moment.
     
  20. BusinessCatStudio

    BusinessCatStudio

    Joined:
    Aug 11, 2020
    Posts:
    2
    Steam Leadearboards works fine in Unity. But when I make a build then when I open leaderboard game closes or crashes. How to fix it?
     
  21. BusinessCatStudio

    BusinessCatStudio

    Joined:
    Aug 11, 2020
    Posts:
    2
    Where did you get dlls from? from sdk file? I copied it and pasted where .exe file is but it still crashes and doesnt wotk.
     
  22. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    633
    My plugin is basically build on top of Steamworks.NET:
    https://steamworks.github.io/

    What you could do would be download the Unity package and import it into your project from here:
    https://steamworks.github.io/installation/#unity-instructions

    Alternatively, you go to the folder below and copy all DLLs and paste them to the folder of your exe file after build.
    c:\Workspace\MyAssetStoreTools\Steam\EasySteamworksIntegration\programming\EasySteamworksIntegration\Assets\Plugins\x86_64\
    What might also help is moving the file below to the folder of your exe file after build
    c:\Workspace\MyAssetStoreTools\Steam\EasySteamworksIntegration\programming\EasySteamworksIntegration\steam_appid.txt

    It would also be very helpful to get the log just after crashing.
     
  23. Abnormalia_

    Abnormalia_

    Joined:
    Jul 23, 2013
    Posts:
    129
    Is this compatible with Il2cpp ?
     
  24. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    633
    I never tried. Feel free to try out and ask for a refund if it doesn't work.
     
  25. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    633
    I have just submitted the newest update, here is the changelog.
    Let me know if something doesn't work as expected.

    v1.25:
    - updated to Steamworks.NET 20.1.0
    - updated Unity base version to 2019.4.20f (newest Unity releases are also supported)
    - added support for IL2CPP builds
    - big user data like replays can now be attached to score entries
    - added SteamLeaderboardsMain.DownloadScoreUGCData
    - added the p_scoreUGCData SteamLeaderboardsMain.UploadScore method
    - added CUSTOM_SCORE_FORMAT to SteamLeaderboardsUI class allowing to show MPH and KMH
    - multiple leaderboards can be downloaded in the same frame
    - now reusing already uploaded icon in the update owned item example
    - added more examples scenes
    - improved debug logging
     
  26. ifog

    ifog

    Joined:
    Sep 30, 2013
    Posts:
    3
    Version 1.25 is available on the Unity asset store ?
     
  27. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    633
    The Asset Store is giving me a hard time because of the naming of the plugin... So no, they are rejecting publishing the update with Steamworks being part of the name... Send me a PM with your purchase order number and I can send you the package for 1.25.
     
    ifog likes this.
  28. ifog

    ifog

    Joined:
    Sep 30, 2013
    Posts:
    3
    Sure, I'll do it tomorrow.
    Hope you can sort it out with the Asset Store.
     
    FreebordMAD likes this.
  29. ifog

    ifog

    Joined:
    Sep 30, 2013
    Posts:
    3
    So, with 1.25 version, I was able to make a IL2CPP build.
    So far, before further testing, I see no problem. :)
    Thanks
     
  30. asiangrapes

    asiangrapes

    Joined:
    Jan 25, 2022
    Posts:
    3
    Hi, I recently bought this asset pack and found it working great. Just a silly question but how would i go about changing the font of the text highlighted in the picture to work with 'TextMeshPro' font
     

    Attached Files:

  31. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    633
    Open the LeaderboardListEntry prefab and navigate to the text entry highlighted. Let me know if you need any more details or help on this topic.
     
  32. asiangrapes

    asiangrapes

    Joined:
    Jan 25, 2022
    Posts:
    3
    Thanks for the help! I managed to get it working with custom font. Another issue i encountered was that I wanted to include buttons in the popup leaderboard. Although whenever I add buttons they become locked on the bottom of the board. How would i be able to edit / move them around?
     

    Attached Files:

  33. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    633
    That depends on how you have setup the Transform properties of these buttons. Can you send me some inspector screenshots or capture a short movie going through your buttons and their parent elements?
     
  34. asiangrapes

    asiangrapes

    Joined:
    Jan 25, 2022
    Posts:
    3
    Sorry about the cut-off response, I managed to fix the problem myself. Although my game is released now but whenever I view the leaderboard the top score is 189 and I'm unable to view the actual top score. How would i be able to fix this?
     

    Attached Files:

  35. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    633
    Glad to hear you figured it out, what's the name of your game?

    189 has the highest score of 2809, what exactly is wrong with the sorting?
     
  36. BrazaTattoo

    BrazaTattoo

    Joined:
    Jun 6, 2020
    Posts:
    3
    Olá, preciso de ajuda... Testei dentro do unity e está normal, consigo atualizar a partitura e abrir a janela. Mas quando crio a compilação do jogo e tento extrair as informações da tabela de classificação, o jogo simplesmente fecha.
     
  37. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    633
    Hi there,
    if Google translator is right, then you game crashes on start. Do you have the Steamworks and Steamworks.NET DLLs in the same folder as your game's exe file? Any other error message or details could help.
     
  38. BrazaTattoo

    BrazaTattoo

    Joined:
    Jun 6, 2020
    Posts:
    3
    Oi estou testando mal quando tento puxar meu leaderboard ele trava na tela de carregamento.
     
  39. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    633
    Do you have any errors, can you attach the Editor log?