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.

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

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.InitializeInstance(config);
PlayGamesPlatform.Activate();
PlayGamesPlatform.Instance.Authenticate(SignInInteractivity.CanPromptOnce, (result) =>{
Debug.Log("Signedin");
});
}
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.
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.
Glad the guide was helpful. Let us know if you need any other Unity tutorial.
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!
Thanks for the input, we will try to publish a tutorial on saved games using Google Play services.
Awesome, I appreciate your guys’ support. I have been looking at what else your website has to offer and will be considering the course. A lot of useful information is in this blog post and your people to hire section is something else I’ve been looking at. I’ll definitely spread the word to anyone else needing help.
Here is the tutorial on Google Play saved games https://vionixstudio.com/2022/04/07/how-to-save-load-file-using-google-play-services/
how to have a leaderboard in my unity game?
Hi, check on our tutorial on leaderboards. Here is the link
https://vionixstudio.com/2022/03/10/google-play-services-leaderboard-in-unity/
not working at all
Hi, let us know the exact problem so we can help.
How to set up Google Play games in unity would be really nice
Hi
We tried to make this article as detailed as possible. I am not sure where you are facing problem. So, it’s better to get an expert to look at it. You can hire this guy who will set it up for you. https://go.fiverr.com/visit/?bta=76956&brand=fiverrhybrid&afp=Comment&landingPage=https%3A%2F%2Fwww.fiverr.com%2Fdanyalahmed1995%2Fintegrate-google-play-achievements-in-your-unity-game