PlayGamesClientConfiguration 초기화 클래스를 PlayGamesPlatform.Instance.Authenticate() 클래스로 바꿉니다.
PlayGamesPlatform 초기화 및 활성화는 필요하지 않습니다. PlayGamesPlatform.Instance.Authenticate()를 호출하면 자동 로그인 결과를 가져옵니다.
C#
Unity Hub에서 PlayGamesClientConfiguration 클래스가 있는 파일을 찾습니다.
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();}
다음과 같이 업데이트합니다.
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).}}
팝업, 리더보드, 업적이 Play 게임즈 서비스 사용자 인터페이스 (UI)의 다양한 화면 크기와 방향에 올바르고 일관되게 표시됩니다.
Play 게임즈 서비스 UI에 로그아웃 옵션이 표시되지 않습니다.
플레이어 ID를 성공적으로 가져올 수 있는지 확인하고, 해당하는 경우 서버 측 기능이 예상대로 작동하는지 확인합니다.
게임에서 서버 측 인증을 사용하는 경우 requestServerSideAccess 흐름을 철저히 테스트합니다. 서버가 인증 코드를 수신하고 액세스 토큰으로 교환할 수 있는지 확인합니다.
네트워크 오류, 잘못된 client ID 시나리오의 성공 및 실패 시나리오를 모두 테스트합니다.
게임에서 다음 기능을 사용한 경우 마이그레이션 전과 동일하게 작동하는지 테스트하세요.
리더보드: 점수를 제출하고 리더보드를 확인합니다. 플레이어 이름과 점수의 올바른 순위 및 표시를 확인합니다.
업적: 업적을 잠금 해제하고 Play 게임 UI에 올바르게 기록되고 표시되는지 확인합니다.
저장된 게임: 게임에서 저장된 게임을 사용하는 경우 게임 진행 상황을 저장하고 로드하는 작업이 원활하게 작동하는지 확인합니다. 특히 여러 기기에서 그리고 앱 업데이트 후에 테스트하는 것이 중요합니다.
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2025-07-27(UTC)
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-07-27(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)"]]