Add Google Play Game Services to your Android Game in Unity – Leaderboards Tutorial



In today’s tutorial video, I show you how to add Google Play Games Services to your Unity game. You can use Google Play Games Services to add leaderboard, achievements, events, multiplayer functionality and more to your Android game. I cover everything you need to do so be sure to check out the time codes below if you want to skip around.

As always let me know if you have any questions or need me to clarify anything! Enjoy!

Time Codes:
0:00 – Tutorial Scope/Prerequisites
2:28 – Downloading/Importing Play Games Plugin for Unity
3:28 – Android Player/Build key Setup
4:43 – Adding JDK to your Windows environment path
6:43 – Creating a new game in the Google Play
8:13 – Generating the OAuth2.0 Client id
10:45 – Creating a Leaderboard
12:10 – Getting the GPGS resources for our configured game
12:37 – Giving beta testers access to your game
13:26 – GPGS Setup in Unity
14:03 – Unity Project Overview
15:36 – Play Games Controller C# Script
16:11 – Authenticating Users with GPGS
17:43 – Posting Scores to a leaderboard
19:30 – Showing the leaderboard UI
20:38 – UI Controller C# Script
22:44 – Final Configurations and Making a Build
23:32 – Demonstrating Functionality on Android Device
25:32 – Our Game in the Play Games App
26:50 – Outro

Resources:
My Unity Project – https://drive.google.com/open?id=1rbc71Cu6NRrCtG68fjWboWswJUvpnbii

Google Play Games Plugin for Unity – https://github.com/playgameservices/play-games-plugin-for-unity

Google Play Developer Console – https://play.google.com/apps/publish

Adding additional permissions to GPGS – https://github.com/playgameservices/play-games-plugin-for-unity#adding-additional-scopes

Google Play Leaderboard API – https://github.com/playgameservices/play-games-plugin-for-unity#accessing-leaderboard-data

Please ‘Like’ this video and share it with anyone who is interested in video game development.

Subscribe to the channel for much more independent video game developer related content including tutorials, design breakdowns, industry events, VLOGs, and much more fun stuff!

Links:
Blog:
https://turbomakesgames.com

My Game Development Studio’s Website:
https://homecookedgames.com

My GitHub:
https://github.com/JohnnyTurbo

Music by: Joakim Karud http://youtube.com/joakimkarud

My Setup:
Camera – Yi Action Cam – https://amzn.to/2FSRxLk
Webcam – Logitech C922x Pro – https://amzn.to/2HTinFp
27″ 4K Monitor – Asus PG27AQ – https://amzn.to/2Mkg7X2
Laptop – Asus GL502VS – https://amzn.to/2FNKiET
Keyboard – Das Keyboard 4 Ultimate – https://amzn.to/2W7SHZd
Other Keyboard – Ducky One 2 Mini – http://bit.ly/2I8ivQI
Headset – PlayStation Platinum Wireless Headset – https://amzn.to/2FR6n58

As an Amazon Associate I earn from qualifying purchases.

#GooglePlay #GameDev #AndroidTutorial

44 thoughts on “Add Google Play Game Services to your Android Game in Unity – Leaderboards Tutorial”

  1. Can we get an updated version? Process has changed, it's actually sort of hard to follow. Their process, not yours. Regardless, thanks for your contribution. The tutorial's a bit shorter at 1.25x speed 😀

  2. i have been bouncing around so many different tutorials and documentations that I have completely lost myself in this process…

    At some point I had already set up a google cloud platform project for my game. Now when I go into the API access tab in Play Console, I cannot choose my project in "Link Existing Project" dropdown… it doesn't show up. Any advice? I have some of the code written and implemented for a Sign In button in Unity, but it fails. I do see some API calls but showing tons of errors on the various consoles i have to sign into… so frustrating

  3. Anybody can help me? I trying to add google serves to my game but every time I failing. I refresh SHA-1 code and all plugins. But in play console wrote that I should “Add google play serves SDK”. I don’t know how do this. Also I describe a problem:when I build my game, publishing in google and open, google services don’t working. I mean the screen add some dark for a second, then nothing. I don’t know what to do. (Google service plugin in unity is 0.10.12).

  4. Hey man. First of all thanks for the tutorial. I have a question though. I know the video is old and all, but I am struggling with an issue where I can log in to google play games without any problems in my alpha build, but any testers cannot. Do I have to enable for other people to be able to login or something?

  5. This whole process in the Developer Console and Google Cloud Platform is 2-3x longer now. It's a PITA. But in the same time (over 2 years) the leaderboards are still just as extremely basic

  6. All of this is good, but you'd have to have a completely different parallel system if you also launch on iOS.. and another one on desktop.. Are there no cost effective platform agnostic front end login systems and backend systems that are indie friendly?

  7. Please help! I am only doing sign in part. After building it show Signing in to Google Play games but then after it cancelled. It dont show any email it just cancelled!

  8. Hey, is it normal that in unity im getting "Unable to sign in to Google Play Services" error? How can i fix it. And after installing apk on my device play games doesnt launch

  9. If you are using Win10 and setting path (as shown) it is not allowing access to keytool despite it being correct path? Anyways the solution is this:

    copy your desired bin folder path

    open cmd

    enter : set Path=(then paste the path you copied with no parenthesis OR spaces after the = )

    should look something like this (note: do not copy and paste this)

    set Path=C:Program FilesJavajdk1.8.0_211bin

    if success there should be no message and can now type keytool and should see list of commands

  10. whqt if i unistand and reinstall the game will i he able to see the leaderboard with my name and score and the score that was before i uninstalled it?

  11. I am getting this error in the adb logcat when I try to sign in. Would you know what's causing it? Google doesn't seem to be much help for troubleshooting it. I want to say something is wrong with he oAuth2 client, but I set up hooks for both my build SHA1 and my Google Play managed SHA1 so it should be working no matter what build I am using.
    "[Play Games Plugin 0.10.11] 09/26/20 21:32:5105:00 ERROR: No client available, returning null"

  12. It was a solid tutorial but still i cant seem to implement this sign in service to my already existing game. And I dont get any errors. How can i identify the problem?

  13. Two years aftear releasing the video, it is still helpfull.
    I was so lost about google play, but thanks to you its everything working now.
    Thank you so much.

  14. Great tutorial!

    I had issues signing into the Google Play Store. My issue was:
    The only certificate the command prompt provided me with was the SHA256, which is much longer than the required SHA1. I didn't realize this mistake at the time, so I used the SHA256, and my app did not work.
    To change this, there's no need to delete anything. Just go back to your command prompt and instead of:
    $ keytool -list keystore
    type:
    $ keytool -list -v -keystore
    Then, it'll show both SHA1 and SHA256.
    Copy the SHA1 and navigate to https://console.developers.google.com/apis/credentials
    Find your game under 'OAuth 2.0 Client IDs', and paste in the 'SHA-1 certificate fingerprint'.
    Then save.
    No need to rebuild, just close and run the app again and it should work.

    My score didn't automatically post to the leaderboard, but I just had to change 'All' to 'Friends', then change the preferences so everyone can see my score, then it worked.

  15. Thank you for the video. One question: is there a way to display a non fullscreen leaderboard? For exemple when you finish a level , display the leaderboard next to some other UI (like play again button etc.)?

Comments are closed.