Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Easy Achievements and Leaderboards - Engage your players

Discussion in 'Assets and Asset Store' started by GleyGames, Jun 2, 2018.

  1. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    481
    Easy Achievements and Leaderboards
    Engage your players easily
    easy-achievements.jpg
    Get it now from the Asset Store
    For detailed implementation instruction see the Documentation


    Download Android Demo

    Key features:
    • Submit achievements and scores with minimal setup.
    • Same code for both Android and iOS platforms.
    • Just import the Google Play Games SDK - no additional setup is required for Android
    • No additional SDK is required for iOS.
    • Error prone - all messy string type ID’s will auto generate into an enum i.e. LeaderboardNames, AchivementNames, for an easy, error free usage in your code.
    • Works with Unity 5.3 and above.
    Currently supported platforms:
    • Android - Google Play Services
    • iOS - Game Center
    Easy setup from a Custom Editor Window:

    combined achievements setup.png
    Simple methods to submit achievements and scores that work for all platforms:
    • Login
    Code (CSharp):
    1. GameServices.Instance.LogIn(UnityAction<bool> LoginComplete = null);
    2.  
    3. private void LoginComplete (bool success)
    4. {
    5.      if(success==true)
    6.      {
    7.           //Login was successful
    8.      }
    9.      else
    10.      {
    11.           //Login failed
    12.      }
    13. }
    • Submit Achievements
    Code (CSharp):
    1. GameServices.Instance.SubmitAchievement(AchievementNames achievementName, UnityAction<bool,string> SubmitComplete = null);
    2.  
    3. private void SubmitComplete (bool success, string message)
    4. {
    5.      if(success)
    6.      {
    7.           //achievement was submitted
    8.      }
    9.      else
    10.      {
    11.           //an error occurred
    12.           Debug.LogError("Achievement failed to submit: " + message);
    13.      }
    14. }

    • Show Achievements
    Code (CSharp):
    1. GameServices.Instance.ShowAchievementsUI();
    • Submit Score
    Code (CSharp):
    1. GameServices.Instance.SubmitScore(long score, LeaderboardNames leaderboardName, UnityAction<bool, string> SubmitComplete = null);
    2.  
    3. private void SubmitComplete(bool success, string message)
    4. {
    5.      if(success)
    6.      {
    7.           //score successfully submitted
    8.      }
    9.      else
    10.      {
    11.           //an error occurred
    12.           Debug.LogError("Score failed to submit: " + message);
    13.      }
    14. }
    • Show Leaderboards
    Code (CSharp):
    1. GameServices.Instance.ShowLeaderboadsUI();
    Any sugestions are always welcome.

     
    Last edited: Aug 25, 2018
    DrOcto likes this.
  2. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    481
    DrOcto likes this.
  3. DrOcto

    DrOcto

    Joined:
    Sep 15, 2017
    Posts:
    79
    You're on the go!!! :D:) Have so much to look and test this summer :D Big thank you again!
     
  4. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    481
    We are glad you like our plugins. Please let us know if you need some changes of new features to this plugin.
     
  5. RichyK

    RichyK

    Joined:
    Feb 8, 2015
    Posts:
    49
    When I use the above line in a method, the IDE objects:

    UnityAction is a type which is not valid in the given context
    Invalid express term bool
    The name LoginComplete does not exist in the current context

    It doesn't work outside of a method either.

    What am I doing wrong?

    Thanks,

    Richard
     
  6. RichyK

    RichyK

    Joined:
    Feb 8, 2015
    Posts:
    49
    Oh but when using your demo scene, built for Android, when I press the Login button nothing happens, it just ignores me. So I could use the demo code, if only it worked :) I don't believe there are any permissions required, what am I missing?

    Richard
     
  7. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    481
    Hello,
    Did you add your id-s in the Settings Window like this:
    android achievements setup.png
    To login you have to do something like this:
    Code (CSharp):
    1. GameServices.Instance.LogIn(LoginComplete);
    2.  
    3. private void LoginComplete (bool success)
    4. {
    5.      if(success==true)
    6.      {
    7.           //Login was successful
    8.      }
    9.      else
    10.      {
    11.           //Login failed
    12.      }
    13. }
    Please let us know if you managed to make it work.
     
  8. RichyK

    RichyK

    Joined:
    Feb 8, 2015
    Posts:
    49
    Hi,
    I eventually gave up, restored my project and installed the Google Play Games Unity plugin and started to use that directly but that had issues too though extremely hard to diagnose. It turned out to be the javahome path which was pointing to a non-existent location. All fixed now, but I'll continue using the GPG plugin as it's quite easy to use anyway :)

    Thanks!
     
  9. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    481
    Ok, no problem

    Our plugin has almost the same implementation as the plugin from Google, but if you need the achievements and leaderboards from iOS also, you just have to add your iOS id`s and it will work, no aditional work is needed. This is the way it was intended to be used.
     
  10. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    481
    Version 1.1.2 of the plugin was just submitted for review to the Asset Store.
    We fixed a crash that sometimes occurs in Unity 2018 due to an invalid game id.
     
  11. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    481
    Hello,

    We just released a video tutorial with step by step instructions on how to create an app on Google Play, create Game Services, add achievements and leaderboards, add test users, and finally integrate our plugin using Unity. We hope this will help more users with the setup of Game Services.

     
  12. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    481
  13. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    481
    If you are interested in this plugin but you think is too expensive write us an e-mail at gley.mobi@gmail.com
    We have 4 free vouchers waiting for you.
     
  14. Ohyouknow

    Ohyouknow

    Joined:
    Oct 23, 2013
    Posts:
    115
    Hey @GleyGames , just bought this asset and it's not working with Unity 2018.2.11f1. Sent you an email just now as well.

    Any idea whats going on? I was using "very simple leaderboard" prior to your asset, and that stopped working with the latest google play sdk and/or latest unity. Could you help? Everything is setup correctly on my end.
     
  15. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    481
    Hello,
    We just check our plugin with Unity 2018.2.11 and it works on our side.
    Please check the following points that might cause your app to fail:
    1. the google play app id is not correct
    2. you are not a tester
    3. you should download your app from google play from alpha or beta test first time you test your game services
    4. your app is not signed with the same key as one from the store
    5. your Game Services from google account are not published.
    Please verify and let us know if the problem persists.

    Also you can follow our step by step tutorial and your app should work:
     
  16. digiross

    digiross

    Joined:
    Jun 29, 2012
    Posts:
    323
    I need an asset like this. How optimized is the asset, meaning does it support a 100 achievements or can it support 1000's without much noticeable difference. Thanks
     
  17. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    481
    Hello,
    It supports as many achievements as Google Play console supports we do not know what is the maximum number of achievements permitted by Google.
    The asset is not dependent by the number of achievements, you just have to set up all your 100 achievements in our settings window and the asset will work the same even if you set 1 or 1000.
    You can check our documentation to see how it works and if you have more questions we are happy to answer them.
     
    digiross likes this.
  18. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    481
  19. Tuism

    Tuism

    Joined:
    Oct 23, 2013
    Posts:
    28
    Hey there, I'm using your plugin and something seemingly very simple isn't working:

    Screenshot 2018-11-16 at 18.55.23.png

    I have "using UnityEngine.Events;". I have installed Google Play Services. What else am I missing?

    Please assist, thanks!
     
  20. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    481
    Thank you for using our plugin.

    To login you simply have to call this:
    Code (CSharp):
    1. GameServices.Instance.LogIn();
    If you want to see if the login was successful or not you have to do this:
    Code (CSharp):
    1. GameServices.Instance.LogIn(LoginComplete);
    2. private void LoginComplete (bool success)
    3. {
    4.      if(success==true)
    5.      {
    6.           //Login was successful
    7.      }
    8.      else
    9.      {
    10.           //Login failed
    11.      }
    12. }
    You can watch this step by step tutorial that will guide you through the entire process of creating and testing achievements and leaderboards.
     
  21. Tuism

    Tuism

    Joined:
    Oct 23, 2013
    Posts:
    28
    Thanks for your reply, your answer worked - I was wondering why it doesn't say exactly that in your documentation here? http://gley.mobi/documentation/Gley-GameServices-Documentation.pdf

    I'm not a really experience developer so I might have missed some syntax but I thought this was made for absolute beginners, which I'm not (at least)

    In any case, I have another problem, during build (I'm building with Gradle because I'm using another plugin, Adincube, and they require Gradle building) I hit an error that I've not seen before using this plugin, so I assume it has something to do with it. Please assist!! Thank you!!

    Code (CSharp):
    1. The attribute meta-data#com.google.android.gms.games.APP_ID@value=\ in :GooglePlayGamesManifest.plugin collides with another value
    2. (See the Console for details)
    Code (CSharp):
    1. CommandInvokationFailure: Gradle build failed.
    2. /Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/bin/java -classpath "/Applications/Unity/PlaybackEngines/AndroidPlayer/Tools/gradle/lib/gradle-launcher-4.2.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx2048m" "assembleDebug"
    3.  
    Code (CSharp):
    1. UnityEditor.BuildPlayerWindow+BuildMethodException: 3 errors
    2.   at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (BuildPlayerOptions options) [0x0021f] in /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPlayerWindowBuildMethods.cs:187
    3.   at UnityEditor.BuildPlayerWindow.CallBuildMethods (Boolean askForBuildLocation, BuildOptions defaultBuildOptions) [0x0007f] in /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPlayerWindowBuildMethods.cs:94
    4. UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()
    5.  
     
  22. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    481
    The documentation says this:
    Code (CSharp):
    1. GameServices.Instance.LogIn(UnityAction<bool> LoginComplete = null);
    That means that this method needs to have an optional parameter (by default is null) that needs to be of type UnityAction<bool> (any method that has a parameter of type bool).

    If our documentation looked like this(as you suggested):
    Code (CSharp):
    1. GameServices.Instance.LogIn(LoginComplete);
    You would have no clue about what that LoginComplete parameter means and it will be impossible for you to guess what you should put there.

    We never said anywhere that this plugin is for absolute beginners and no coding knowledge is required. We just said that we have a step by step tutorial that can be followed even by beginners.
    We are currently working at a complete game integration of this plugin but it is not ready yet.

    About your other question:
    Please make sure that the GooglePlayGamesManifest.plugin is disabled. See the screenshot bellow:
    plugin.PNG
    You can also delete that folder entirely, it is not required.

    If you still have that error search all your manifest files for this line:
    com.google.android.gms.games.APP_ID
    you should have that only once in all your manifest files.
     
  23. Tuism

    Tuism

    Joined:
    Oct 23, 2013
    Posts:
    28
    Okay, I'm currently using

    Code (CSharp):
    1. GameServices.Instance.LogIn();
    As you've mentioned above.

    Then I went to that location you described in my project - how do I open up my inspector to get to those manifest.plugin import settings? This is what I see:

    Screenshot 2018-11-20 at 16.46.17.png

    And if I deleted GooglePlayGamesManifest.plugin, attempts to build get me an error that reference that folder?

    Thanks for your support!
     
  24. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    481
    First of all that GooglePlayGamesManifest.plugin should be inside Android folder. Probably you moved it outside by mistake.
    And to select it you have to select Android folder on the left and GooglePlayGamesManifest.plugin on the right. Like this:

    selectFolder.PNG
     
  25. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    481
    Hello,
    We just released a major update of the our asset and we are glad to announce that now our asset supports Playmaker actions so if you own a copy of Playmaker no coding is required for implementation.

    Here is a step by step tutorial on Playmaker integration:
     
  26. IndleStudios

    IndleStudios

    Joined:
    Oct 12, 2017
    Posts:
    9
    I have a problem. when I run the application on the mobile phone .. do not log in google .. already tried several possible solutions .. my code sdh1 is correct .. I added the testers. the game is published in the alpha. and still do not make connections .. bought your asset. but the problem remains even after redoing all your video two times ... what is up?? I do not know what to do anymore

    when I click the login button. nothing happens.
     
  27. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    481
    Hello
    Please check the log on your device and see what error do you get when you press the login button. If nothing happen you will get some debug messages.
    Let us know about the error you are getting and we can help you.
     
  28. LiveWire

    LiveWire

    Joined:
    Dec 6, 2011
    Posts:
    15
    Is there functionality to reset achievements?
     
  29. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    481
  30. Abydos85

    Abydos85

    Joined:
    Feb 12, 2016
    Posts:
    1
    Hello, i'm pretty much a noob at developing and i'm having some issues. For one I can't seem to get the leaderboard or achievements buttons in my game to work, they do nothing when pressed. Also every time I click on the restart button it logs into google play every time. Will you be able to help with this?
     
  31. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    481
    Hello,

    We have a step by step integration tutorial that might help test if your achievements and leaderboards work:


    To stop logging in every time you restart your game you can check if user is already logged in and call the login method only if it is not, like this:
    Code (CSharp):
    1. if(GameServices.Instance.IsLoggedIn()==false)
    2. {
    3.      GameServices.Instance.LogIn();
    4. }
    To show your leaderboards you have to call this method:
    Code (CSharp):
    1. GameServices.Instance.ShowLeaderboadsUI();
    To show your achievements list you have to call this method:
    Code (CSharp):
    1. GameServices.Instance.ShowAchievementsUI();
     
  32. LiveWire

    LiveWire

    Joined:
    Dec 6, 2011
    Posts:
    15
    Yes, I wish to be able to reset achievement progress prior to publishing in order to test them more than once.
    In the Google Play Console under Game Services you can reset each one manually one-by-one, but a simple method call from inside the app to reset them all would be extremely useful.

    It would also be useful for iOS achievements (other plugins I have used include this functionality). I'm am investigating moving over to your plugin because it takes care of both iOS and Android achievements, and noticed the ability to reset achievement progress is missing.
     
  33. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    481
    Thank you for your interest, but for now that feature is not available in our plugin. If you require that feature than our plugin it is not for you.
    We will consider including such feature in our plugin in the future but for now we cannot help you with this. We are sorry.
     
  34. Cal_Mac

    Cal_Mac

    Joined:
    Feb 4, 2018
    Posts:
    22
    Trying to debug why on Android it keeps coming back as a failed log in, set up seems okay. Followed the trouble shooting guide. Is there a way to debug or get an error code from the Failed log in attempt?
     
  35. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    481
    Hello,
    Please make sure your app is downloaded from google play, and you are a tester for your app.
    To debug you app you can use Monitor(located in Tools folder) from the Android SDK.
    Let us know if you need more assistance.
     
  36. rsherzod

    rsherzod

    Joined:
    Oct 30, 2016
    Posts:
    5
    Hi Gley Games could you also show how to write submitting score to leaderbord
    GameServices.Instance.SubmitScore(long score, LeaderboardNames leaderboardName,
    UnityAction<bool, GameServicesError> SubmitComplete = null); this code is giving error, I am new to programming thats why i am struggling to make it work
     

    Attached Files:

  37. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    481
    Hello,
    Leaderboard names should be an enum that is generated when you add your leaderboard names to our Settings window. Please check this tutorial:
     
  38. marinero002

    marinero002

    Joined:
    Feb 2, 2019
    Posts:
    3
    Hello, I have purchased the plugin recently. I have followed all the steps in the document. But I am not able to login to Google Play Games. When the login process begins, Google's UI pops up indicating that it connects to Play Games. However, when the process ends, login attempt callback returns success=false. And there is no error message about the reason for the failure. I have confirmed all of these steps:
    1. the google play app id is not correct
    2. you are not a tester
    3. you should download your app from google play from alpha or beta test first time you test your game services
    4. your app is not signed with the same key as one from the store
    5. your Game Services from google account are not published.
    still can't get it to work.

    A piece of extra information is that I set up your plugin with the required id's and everything was fine. But when I exported the project into Android Studio, the Play Games plugin complained that it's not setup correctly . So I have filled the Play Games form with the required data (I have attached a picture of this). Could this have led to a conflict between your plugin and the Play Games plugin? Thanks in advance...
     

    Attached Files:

  39. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    481
    Hello,
    You do not need to fill up that Play Games plugin window, it will not be used at all.
    The best way to debug your app is to connect your android device to android monitor and read the logs directly from device, you will get the full error messages there. They are not available into Unity to display them on your screen.

    Another common issue is that you SHA1 fingerprint does not match the one from the store, please see this thread on how to fix that:
    https://stackoverflow.com/questions/19622603/there-is-no-linked-app-associated-with-this-client-id

    If you are not able to fix or debug your app, please add us as a tester, e-mail: gley.mobi@gmail.com and send us your test link and we will connect our device to monitor and tell you what is your error, but you can do this on your own.
     
  40. marinero002

    marinero002

    Joined:
    Feb 2, 2019
    Posts:
    3
    Thanks for the reply. I will check this out and reinform you.
     
  41. knuppel

    knuppel

    Joined:
    Oct 30, 2016
    Posts:
    97
    Hello,
    is there a method to get the google play username and user id?
     
  42. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    481
    Hello,
    Our asset does nut support such a feature, but after the user is authenticated you can use the following code:
    Social.localUser.id
    Social.localUser.userName
     
  43. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    481
    Hello,
    We just want to announce that our asset now supports Game Flow visual scripting. An integration tutorial can be found here:
     
  44. Artomiano

    Artomiano

    Joined:
    Dec 1, 2014
    Posts:
    200
    Hi,

    your assets looks interesting. Achievements and Leaderboards are great - exact what I looking for. BUT - also for posting on my own webserver. Could you extend your asset with a mysql/php server port? I want to show achievements and a leaderboard on my website too.
     
  45. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    481
    Hello,
    Thank you for your interest in our asset, unfortunately what are you asking is beyond the scope of our plugin. That cannot be a general scope, because each website is different and uses a different kind of database so you need a dedicated server as Google and Apple have to be the same for everybody and we do not provide server solutions. Sorry.
     
  46. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    481
    Hello,
    We just added support for Bolt Visual Scripting. The full tutorial is available here:
     
  47. javeeljj

    javeeljj

    Joined:
    Nov 10, 2019
    Posts:
    1
    :(to be honest guys, the video tutorial only shows how to set up to work with the example that you provided, documentation is also not pretty useful, even if its not for beginners or whatever i think everything shouldve been explained as if we were indeed beginners
     
  48. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    481
    Hello,
    More clear than this we cannot do it. A step by step integration inside a game.
    What is not clear in here?
     
  49. Ikaro88

    Ikaro88

    Joined:
    Jun 6, 2016
    Posts:
    280
    I can use this for monthly leaderboard?
     
  50. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    481
    Hello,
    This asset uses the Google or Apple leaderboards. There are no monthly leaderboards.