Search Unity

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:
    43
    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:
    517
    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:
    517
    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 ;)
     
unityunity