Stay organized with collections
Save and categorize content based on your preferences.
This document describes how to migrate existing games from the games v1
SDK
to the games v2
SDK.
The Play Games plugin for Unity, versions 10 and earlier, uses the games v1 SDK.
Before you begin
Make sure that you have already set up Play Console and
installed the Unity Hub.
Download the Google Play Games plugin for Unity
To benefit from the latest features in the Play Games Services, download and
install the latest plugin version. Download it from the gitHub
repository.
Remove the old plugin
In the Unity Hub, remove the following folders or files.
Remove the highlighted folders in your Unity project
(click to enlarge).
Import the new plugin to your Unity project
To import the plugin to your Unity project, follow these steps:
Open your game project.
In the Unity Hub, click Assets > Import Package > Custom Package
to import the downloaded
unitypackage
file into your project's assets.
Make sure that your current build platform is set to Android.
In the main menu, click File > Build Settings.
Select Android and click Switch Platform.
There should be a new menu item under Window > Google Play Games. If
there isn't, refresh the assets by clicking Assets > Refresh and
then try setting the build platform again.
In the Unity Hub, click
File > Build Settings > Player Settings > Other Settings.
In the Target API level box, select a version.
In the Scripting backend box, enter IL2CPP.
In the Target architectures box, select a value.
Note the package name package_name.You can use this information
later.
Replace the PlayGamesClientConfiguration initialization class with the
PlayGamesPlatform.Instance.Authenticate() class.
The initialization and activation of
PlayGamesPlatform
is not required. Calling PlayGamesPlatform.Instance.Authenticate() fetches the
result of automatic sign-in.
C#
In the Unity Hub, locate the files with
PlayGamesClientConfiguration class.
usingGooglePlayGames;usingGooglePlayGames.BasicApi;usingUnityEngine.SocialPlatforms;publicvoidStart(){PlayGamesClientConfigurationconfig=newPlayGamesClientConfiguration.Builder()// Enables saving game progress.EnableSavedGames()// Requests the email address of the player be available// will bring up a prompt for consent.RequestEmail()// Requests a server auth code be generated so it can be passed to an// associated backend server application and exchanged for an OAuth token.RequestServerAuthCode(false)// Requests an ID token be generated. This OAuth token can be used to// identify the player to other services such as Firebase..RequestIdToken().Build();PlayGamesPlatform.InitializeInstance(config);// recommended for debugging:PlayGamesPlatform.DebugLogEnabled=true;// Activate the Google Play Games platformPlayGamesPlatform.Activate();}
And update it to this:
usingGooglePlayGames;publicvoidStart(){PlayGamesPlatform.Instance.Authenticate(ProcessAuthentication);}internalvoidProcessAuthentication(SignInStatusstatus){if(status==SignInStatus.Success){// Continue with Play Games Services}else{// Disable your integration with Play Games Services or show a login// button to ask users to sign-in. Clicking it should call// PlayGamesPlatform.Instance.ManuallyAuthenticate(ProcessAuthentication).}}
Pop ups, leaderboards, and achievements display correctly and
consistently on various screen sizes and orientations in the
Play Games Services user interface (UI).
Sign-out option is not visible in the Play Games Services
UI.
Make sure you can successfully retrieve Player ID, and if applicable,
server-side capabilities work as expected.
If the game uses server-side authentication, thoroughly test the
requestServerSideAccess flow. Ensure the server receives the auth code
and can exchange it for an access token.
Test both success and failure scenarios for network errors, invalid
client ID scenarios.
If your game was using any of the following features, test them to ensure that
they work the same as before the migration:
Leaderboards: Submit scores and view leaderboards. Check for the correct
ranking and display of player names and scores.
Achievements: Unlock achievements and verify they are correctly recorded
and displayed in the Play Games UI.
Saved Games: If the game uses saved games, ensure that saving and loading
the game progress works flawlessly. This is particularly critical to test
across multiple devices and after app updates.
Post migration tasks
Complete the following steps after you have migrated to games v2 SDK.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-07-14 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-07-14 UTC."],[],[],null,["# Migrate to Play Games Services v2 (Unity)\n\nThis document describes how to migrate existing games from the [games v1\nSDK](https://developers.google.com/android/games_v1/reference/com/google/android/gms/games/package-summary)\nto the [games v2\nSDK](https://developers.google.com/android/reference/com/google/android/gms/games/package-summary).\nThe Play Games plugin for Unity, versions 10 and earlier, uses the games v1 SDK.\n\nBefore you begin\n----------------\n\n- Make sure that you have already set up Play Console and installed the Unity Hub.\n\nDownload the Google Play Games plugin for Unity\n-----------------------------------------------\n\nTo benefit from the latest features in the Play Games Services, download and\ninstall the latest plugin version. Download it from the [gitHub\nrepository](https://github.com/playgameservices/play-games-plugin-for-unity/tree/master/current-build).\n\nRemove the old plugin\n---------------------\n\nIn the Unity Hub, remove the following folders or files. \n\n```text\nAssets/GooglePlayGames\n\nAssets/GeneratedLocalRepo/GooglePlayGames\n\nAssets/Plugins/Android/GooglePlayGamesManifest.androidlib\n\nAssets/Plugins/Android\n```\n[](/static/images/games/pgs/unityfolders.png) Remove the highlighted folders in your Unity project (click to enlarge).\n\nImport the new plugin to your Unity project\n-------------------------------------------\n\nTo import the plugin to your Unity project, follow these steps:\n\n1. Open your game project.\n2. In the Unity Hub, click **Assets \\\u003e Import Package \\\u003e Custom Package** to import the downloaded [`unitypackage`](https://github.com/playgameservices/play-games-plugin-for-unity/tree/master/current-build) file into your project's assets.\n3. Make sure that your current build platform is set to **Android**.\n\n 1. In the main menu, click **File \\\u003e Build Settings**.\n\n 2. Select **Android** and click **Switch Platform**.\n\n 3. There should be a new menu item under **Window \\\u003e Google Play Games** . If\n there isn't, refresh the assets by clicking **Assets \\\u003e Refresh** and\n then try setting the build platform again.\n\n4. In the Unity Hub, click\n **File \\\u003e Build Settings \\\u003e Player Settings \\\u003e Other Settings**.\n\n5. In the **Target API level** box, select a version.\n\n6. In the **Scripting backend** box, enter `IL2CPP`.\n\n7. In the **Target architectures** box, select a value.\n\n8. Note the package name \u003cvar translate=\"no\"\u003epackage_name\u003c/var\u003e.You can use this information\n later.\n\n The player settings in your Unity project.\n9. [Copy the Android resources from Play Console](/games/pgs/unity/unity-start#copy-android-resources)\n\n10. [Add the Android resources to your Unity project](/games/pgs/unity/unity-start#set-up-unity-project)\n\nUpdate automatic sign-in code\n-----------------------------\n\nReplace the `PlayGamesClientConfiguration` initialization class with the\n`PlayGamesPlatform.Instance.Authenticate()` class.\nThe initialization and activation of\n[`PlayGamesPlatform`](/games/services/unity/v2/api/class/google-play-games/play-games-platform)\nis not required. Calling `PlayGamesPlatform.Instance.Authenticate()` fetches the\nresult of automatic sign-in. \n\n### C#\n\nIn the Unity Hub, locate the files with\n`PlayGamesClientConfiguration` class. \n\n using GooglePlayGames;\n using GooglePlayGames.BasicApi;\n using UnityEngine.SocialPlatforms;\n\n public void Start() {\n PlayGamesClientConfiguration config =\n new PlayGamesClientConfiguration.Builder()\n // Enables saving game progress\n .EnableSavedGames()\n // Requests the email address of the player be available\n // will bring up a prompt for consent\n .RequestEmail()\n // Requests a server auth code be generated so it can be passed to an\n // associated backend server application and exchanged for an OAuth token\n .RequestServerAuthCode(false)\n // Requests an ID token be generated. This OAuth token can be used to\n // identify the player to other services such as Firebase.\n .RequestIdToken()\n .Build();\n\n PlayGamesPlatform.InitializeInstance(config);\n // recommended for debugging:\n PlayGamesPlatform.DebugLogEnabled = true;\n // Activate the Google Play Games platform\n PlayGamesPlatform.Activate();\n }\n\nAnd update it to this: \n\n using GooglePlayGames;\n\n public void Start() {\n PlayGamesPlatform.Instance.Authenticate(ProcessAuthentication);\n }\n\n internal void ProcessAuthentication(SignInStatus status) {\n if (status == SignInStatus.Success) {\n // Continue with Play Games Services\n } else {\n // Disable your integration with Play Games Services or show a login\n // button to ask users to sign-in. Clicking it should call\n // PlayGamesPlatform.Instance.ManuallyAuthenticate(ProcessAuthentication).\n }\n }\n\nChoose a social platform\n------------------------\n\nTo choose a social platform, see\n[choose a social platform](/games/pgs/unity/unity-start#choose-social-platform).\n\nRetrieve server authentication codes\n------------------------------------\n\nTo get server side access codes,\nsee [retrieve server authentication codes](/games/pgs/unity/unity-start#retrieve_server_authentication_codes).\n\nRemove sign-out code\n--------------------\n\nRemove the code for sign-out. Play Games Services no longer requires an in-game\nsign-out button.\n\nRemove the code shown in the following example: \n\n### C#\n\n // sign out\n PlayGamesPlatform.Instance.SignOut();\n\nTest your game\n--------------\n\nEnsure your game functions as designed by testing it. The tests you perform\ndepend on your game's features.\n\nThe following is a list of common tests to run.\n\n1. **Successful sign-in**.\n\n 1. Automatic sign-in works. The user should be signed in to\n Play Games Services upon launching the game.\n\n 2. The welcome popup is displayed.\n\n\n [](/static/images/games/pgs/welcometoast.png) Sample welcome popup (click to enlarge).\n\n \u003cbr /\u003e\n\n 3. Successful log messages are displayed. Run the following\n command in the terminal:\n\n ```bash\n adb logcat | grep com.google.android.\n ```\n\n A successful log message is shown in the following example: \n\n ```bash\n [$PlaylogGamesSignInAction$SignInPerformerSource@e1cdecc\n number=1 name=GAMES_SERVICE_BROKER\u003e], returning true for shouldShowWelcomePopup.\n [CONTEXT service_id=1 ]\n ```\n2. **Ensure UI component consistency**.\n\n 1. Pop ups, leaderboards, and achievements display correctly and\n consistently on various screen sizes and orientations in the\n Play Games Services user interface (UI).\n\n 2. Sign-out option is not visible in the Play Games Services\n UI.\n\n 3. Make sure you can successfully retrieve Player ID, and if applicable,\n server-side capabilities work as expected.\n\n 4. If the game uses server-side authentication, thoroughly test the\n `requestServerSideAccess` flow. Ensure the server receives the auth code\n and can exchange it for an access token.\n Test both success and failure scenarios for network errors, invalid\n `client ID` scenarios.\n\nIf your game was using any of the following features, test them to ensure that\nthey work the same as before the migration:\n\n- **Leaderboards**: Submit scores and view leaderboards. Check for the correct ranking and display of player names and scores.\n- **Achievements**: Unlock achievements and verify they are correctly recorded and displayed in the Play Games UI.\n- **Saved Games**: If the game uses saved games, ensure that saving and loading the game progress works flawlessly. This is particularly critical to test across multiple devices and after app updates.\n\nPost migration tasks\n--------------------\n\nComplete the following steps after you have migrated to games v2 SDK.\n\n1. [Use Play App Signing](/games/pgs/unity/unity-start#create-test-release)\n\n2. [Create an AAB file](/games/pgs/unity/unity-start#create_an_aab_file)\n\n3. [Create an internal testing release](/games/pgs/unity/unity-start#create_an_internal_testing_release)\n\n4. [Verify your App signing credentials](/games/pgs/unity/unity-start#set-up-app-signin)"]]