Beginner’s guide to Google play services in Unity

Google play services is really handy when it comes to features like leaderboard or achievement for your Android games. But there are some critical steps that make it difficult to implement and there are lots of confusing tutorials on YouTube that add to the confusion. In this tutorial, we will go step by step on how to implement Google play services in Unity.

Let’s get play services started

Import Google Play services SDK to Unity

Go to Github and download the latest Google play services Unity package.

Open Unity

Right click in the project folder and select Import Package>Custom Package.

Select the file you have downloaded from Git and import it into Unity.

After the import you should see two new folders, Google Play service and External dependencies in your project window.

If you are getting any errors after package import it is due to external dependencies. To fix it follow the steps below

  • Set your platform to Android
  • If you had enabled Unity ads services then you need to disable it completely.
  • Update your Android SDK.
  • If you have any other Google Services SDK in your project like Google Ads, then you need to uncheck the external dependencies folder during import. If you have already imported then delete both Google play services and external dependencies folders and reimport without the dependencies.

After completing the steps above Go to Assets> External Dependency Manager> Android Resolver> Resolve.

You can ignore the remaining errors. They are mostly platform related errors.

Enable auto resolution if you see this screen

If your project is stuck in the screen shown below, just close it. You can re-run it by going to Assets> External Dependency Manager> Android Resolver> Resolve.

Save your Unity project. It’s time to configure Google play services in Play console.

Play console configuration

If you haven’t already you need to create an app. Just give your app a name and fill in the basic details and click create App. Your App type should be set to Game to use Play services.

Go to the Play Game service>Setup and Management>Configuration.

Select “No, my game doesn’t use Google APIs” and click Create.

Now you should see a checklist of things you need to do.

Next click on Create OAuth consent screen in Google Cloud platform.

This will open up a window. Click on Google Cloud Platform in point number 1. (Don’t close the window)

This will take you to the Google cloud website. Login with your Gmail.

Select external in the options.

In the next screen Fill in App name and email address. Click save and continue.

Don’t add any scope in the next window. Just click save and continue.

In the test users tab, add your email address as a test user and save.

Head back to Google play console and click confirm configuration in the window that popped up earlier.

In the next step you need to configure credentials. Before setting up the credentials you need a keystore in Unity.

Setting up keystore in Unity

Open Unity editor> File> Build settings> Player settings

Go to other settings and select scripting backend as IL2CPP and check ARM 64 in the target architecture.

If you don’t have a keystore already then create one by clicking on Keystore Manager in publishing settings.

Creating Credentials

Go to Google play console and click on Create credentials

Click Add Credentials

Select type as Android, enter your App name and set anti-piracy to off as of now.

Click create OAuth client

Click Create OAuth Client ID in point number 1

Select the application type as Android.

Enter your App name, the same as the play console.

You can get the package name from Unity editor> Player settings> Other settings> Package name.

Now comes the tricky part

You need to enter the command shown in the image above. But you might get an error saying “keytool is not recognized as an internal or external command, operable program or batch file.” This happens if your keytool path is not set properly.

Keytool is generally located inside the JDK folder. If you don’t know where the JDK is then go to Unity editor> Edit>preferences> External tools. You will find the path to the JDK. keytool.exe is located inside the bin folder.

Now you need to run your command in this folder. Use the code below to change folder in command prompt. Replace the path with your JDK path.

>cd C:\Program Files\Unity\Hub\Editor\2021.1.13f1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK\bin

Type the code in Command prompt to open this folder. Now you can run the code to get your SHA1 key

If you get an illegal command error then move your keystore to the same folder as Keytool and run the command below

keytool -keystore example.keystore -list

Enter the password and you will see your SHA1 fingerprint. Copy and paste it in the credential window and click create.

Go back to Google Play console and click Refresh OAuth Client. Now you should see the created client. Select it and click save changes.

Go to the testing tab and create an internal testing release. Upload your app bundle signed with the keystore, add yourself as a tester and roll out for internal testing. (You can roll out an actual release too but it will go through the review process)

You need to add another OAuth credential if you want to test Google play services without uploading to play store every time. (But you need to upload it at least once get this key)

After publishing your testing release. Go to the setup tab and click on App integrity

Click on App signing tab. You should see two SHA1 keys. One for Upload and one for App signing.

Copy the app signing SHA1 key and create a new OAuth credential and add it to your app.

Now you should see two credentials on your Play games service configuration page.

Final configuration in Unity and App testing.

In your Play games services page in Google play console click on the Get Resources button and copy the xml data.

Go to Unity

Click Windows>Google Plays games>Setup> Android Setup

Paste the xml data on to the Resource definition input box and click setup.

Now let’s put in the code to test login

Copy and paste the code below on to your script. Your script must run when the game starts.

using UnityEngine;
using GooglePlayGames;
using GooglePlayGames.BasicApi;
using UnityEngine.SocialPlatforms;

public class retain : MonoBehaviour
    public static PlayGamesPlatform platform;
    void Awake()

        PlayGamesClientConfiguration config=new PlayGamesClientConfiguration.Builder().Build();
        PlayGamesPlatform.Instance.Authenticate(SignInInteractivity.CanPromptOnce, (result) =>{


Now build your game and run it in the android device which has the same email as your test user configured in Google play console.

You should see Play games login screen.

If you have any queries leave it in the comment section below. In the next tutorial, we will create a leaderboard to display scores.

12 thoughts on “Beginner’s guide to Google play services in Unity”

  1. THANK YOU very much! Only guide I could find on the internet that works. I really appreciate the steps, I went through this process many times.

    You’re the best. Would love to see more in depth tutorials involving Unity and Play Games Services.

  2. It seems like you have some good experience with Google Play. I was first using Firebase to hold player data but I was looking into Google Play’s saved games and also having to use separate methods for custom usernames. I scrapped Firebase and their Realtime Database for what I assume Google Play saving will work for. Could you do something for Google Play saving or general API? I got my games going, I’m on my own when it comes to implementing them so you’ve provided huge help getting set up. It took me a week!


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: