Google Play Games Sign In - old
This setup is for a absolut basic setup, using the Google Play Games Login only. Assuming you build your app from scratch.
π Health Check / Goal Project
Windows 10 Home, 21H1, OS Build 19043.1165
Unity 2021.2.9f1 (February 02, 2022)
Module: Android Build Support
Module: iOS Build Support (only to avoid a bug using the GPGS Plugin)
Play Games Plugin for Unity 0.12.10
2D Mobile App
Minimum SDK: API Level 22
Set up a new Unity Project
Select any template of your choice.
Project Name:
MyAppLocation: Anywhere
Set up Android
File > Build Settings > Android
File > Build Settings > AndroidSwitch PlatformCheck
Build App Bundle (Google Play)Click
Switch Platform
Edit > Project Settings > Player
Edit > Project Settings > PlayerOther SettingsIdentificationCheck
Override Default Package NameOverride Default Package Name> Set your<com.mycomp.myapp>Version->0.1.0It doesn't matter what version you are inserting here
Bundle Version Code->1Has to be increased manually every time before you upload it the chnged app once again to Google Play.
Minimum API Level-> Select any Android version of your choiceTarget API Level> Automatic (highest installed)
ConfigurationScripting Backend-> SelectIL2CPPTarget Architectures-> CheckARM64
Publishing SettingsKeystore ManagerDropdown
Keystore>Create New>Dedicated Location>save asmyapp.keystoreFill out all fields as you like
Note that this keystore will generate one specific upload key which can be used to debug locally. Using this keystore, Google will automaticallly create an app sign key after you uploaded it to Google Play for the first time. This app sign key is the one which has to be registered with the credentials.
Unity -> File -> Build Settings -> Build
Google Play Console App: Set up app
Create the App online
Go to
Google Play Console> Create App >Enter your appname:
MyAppDefault Language: Select Englisch (United States) - en-US
App or Game: Select
GameFree or Paid: Select
FreeDeclarations:
Check
Developer PoliciesCheck
US Export Laws
Click
Create App
Set up App Basics
Dashboard>Set up your app>COVID-19 contact tracing and status appsSelect
My app is not a publicly available COVID-19 contact tracing or status appClick
Save
Upload your .aab
Setup->App IntegrityApp bundles-> UploadMyApp.aabClick
Save
From here on an App signing key is automatically created and stored by Google.
Configure Credentials
Play Games Services>Setup and Management>ConfigurationSelect
No, my game doesn't use Google APIsGame Name
MyAppCredentials>Configure OAuth Consent Screen
Configure OAuth Consent Screen
Go to Google Cloud Console
User Type->ExternalClick
CreateOAuth Consent ScreenApp InforamtionApp Name:
MyAppUser Support Mail: Enter
yoursupportmail@yourcompany.com
Developer contact informationEnter
yourtechmail@yourcompany.com
Click
Save and Continue
ScopesClick
Save and Continue
Close this tab
Create OAuth
Click
Add CredentialClick
Create OAuth ClientEnter all values as given
Application Type: Android
Name:
MyAppcom.mycomp.myapp
SHA1
The app signing key certificate generated by google.
Find it in Google Play Console -> Setup -> App Integrity
Download the oauth.json and close the tab
Select the newly created OAuth client
Go back to
Google Play Console-> Select newly createdOAuth ClientClick
Save changes
This credential is used for the official login and only works after you uploaded it to the google play store. If you want to login locally, you have to use the SHA1 of your upload key.
Repeat the steps on Create OAuth . The only difference is to insert the upload key instead of the app signing key. You can retrieve the key by executing:
Add this key to the credentials allows you to sign in on your local device. Requirement is the to be built fully.
Add a Tester
Play Games Services -> Setup and Management -> Testers -> Tab Testers > Add the email you will login on your mobile device. It has to be a Gmail-account.
Google Play Services Plugin: Setup
Install the GPGS Plugin for Unity.
Install the latest Play Games Plugin For Unity in your Unity project.
Download
GooglePlayGamesPlugin-0.10.12.unitypackagefileDouble click it while unity is open to install it.
Apply Google Play Services Resource
Go to Google Play Console>Your App>Play Games Services>Configuration>Credentials>Get resources(on the right hand side)Copy its content
Unity>Window>Google Play Games>Setup>Android Setup ...insert copied
resource contentClick
Setup
The resource file should look similar to the following:
As long as you don't use any services such as achievements or leaderboard, no constant file will be created.
Implement the code
Add new C# script in project window. Drag and drop this script to any object in the Hierarchy view. To keep it easy, drag it onto the Main Camera
If you can't add it, you propably renamed your script, but didn't change the class name within the script itself.
Add a simple text button to show login result: Right click Hierarchy > UI > TextMeshProUGUI.
If it is the first time you are using a TextMeshProUGUI component, you will be notified to import the TMP Essentials. Examples and Extras are not needed.
Select Main Camera in the Hierarchy window and drag the newly created Text object in Hierarchy onto the this GameManager script > Login Result : Field None (Text Mesh Pro UGUI)
Publish your app including Google Play Games Login
In
Unity>Edit>Project Settings>Other Settings>Identification> IncreaseBuild Version Codeby one.In
Unity>File>Build Settings> ClickBuildUpload your .aab to
Google Playas you did inUpload your .aabSave>Review Release>Start Rollout to Interal TestingInternal Testing> TabTesters>How to join your test> Follow thelink
Last updated