GOOGLE Play Games LOGIN In Unity [Easy INTEGRATION] !! 2023 (UNITY 3D, AUTHENTICATION, AND MORE!!)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi guys welcome back to Coco 3D in this video we will implement the Google Play games login which has been used by most of the Android games to authenticate the player so let's get [Music] started now this is a blank Unity project so the first step is to convert the project into the Android for that click on file build setting and select Android and click switch platform and then click on player settings and let's set up the unity project I will change the company name and product name is fine then select resolution and presentation and set it to Portrait then open the other setting and set your target API level to 33 as it is now compulsory then change your scripting backend to I2 CPP and click armm 64 then open the publishing settings and create a key store if you do not have one so let me just quickly create it now with that our setup is completed and now the next step is to install the Google Play games package so open your favorite web browser and search for Google Play games SDK for Unity now click on this GitHub link now open the current build folder and this is the Google Play games package the version is 01.01 simply click on it and click download now drag this file inside your Unity project and click import and after that the Google Play games package is successfully installed and enable this Auto resolution and let's wait for it to finish so now it is completed and now the next step is to create a UI canvas with which our player will interact so let me just quickly create it so first let's create a background and let's set our title image and let's also create a button which will provide the signin functionality and at last let's create a text field in which we will display that the player is logged in or not now with that our UI is is completed and now the next step is the scripting now let's create a empty game object and let me name it as manager and let's create and add a script that will do all the login work play games manager now for the scripting we can find the entire script inside the GitHub itself so let's open the GitHub page now open the main page now in here scroll down to the part where it says that sign in right here now all we have to do is just to paste this script so now let's copy the using statement and paste it right here now copy the line in the start and create a function for it inside the unity name it as sign in and paste that line inside it now copy the last call back function and paste it right below the start function Now call the sign-in function from the start so user don't have to press any button and inside the signin function this is the line which will tell the Google Play games platform that you are performing a sign in attempt which needed a call back function which is our process authentication so basically the process authentication function will get automatically called by the Google Play Games server and will tell us that we are successfully logged in or not so basically if the status is equal equals to success that means we are now perfectly logged in and else we are not logged in so now let's create a text to display this data in the screen and name it as details text now if we are not logged in we can just simply print that sign in failed and if we are logged in then we can display the player details for example his name his ID or image URL and things like that so for the name we can write play game Splat from do instance. get user display name and let's say if we want the unique ID of the player then we can create a string for that too and we can write play games platform. instance. get user ID and similarly if you want to display the image it gives us the image URL so for that we can create a string and we can write play games platform. instance. get user image URL and similarly if you want something else you can search it inside the play games platform class but for now let's just print that we are successfully logged in with the player name so with that our scripting is completed now let's drag and drop all the required field and let's link our button and the next step is to set up the Google Play console now the first step is to create an app if you do not have one already so click on create app give it a name select games and yes it is free accept this condition and then click on create app now scroll down to the configuration under setup and management play game services and select no my game doesn't use Google apis and this name is fine and I think I cannot use the Google in this name so let me just rename it and click on create now scroll down and click configure and open this Google Cloud platform in here select the external and click create now give your app a name so let me just enter a name then select your support email from the dropdown and now scroll down to the bottom and enter your developers email now click on Save and continue now open the credentials and click on create credentials and select the O client ID now from the application type select Android and this name is fine and now we have to enter our package name so let's open unity and we can easily find the package name in our player settings so let's copy this string and paste it right here now it want a sha1 certificate fingerprint for that first open your Java folder open your your C drive open program files open Java then JRE folder and then open bin now copy this path now open your command prompt and write CD and paste your path and click enter so now basically we are now inside our Java folder now copy this command and paste it inside a notepad file now this command want our key store path so let's open Unity right click on assets show in Explorer and here we have our key store so copy this path and paste it inside your notepad file right here and just add a back slash and write user. key store now copy the entire line and paste it inside your command prompt and hit enter and now it will ask for for your key Store password so let me enter my password and here we have our sh1 keys so copy it and paste it inside your Google Play games platform right here then click on create so now we have created our o o client so let's close it for now and let's jump back into the Google Play console and press this confirm configuration now click on ADD CR credentials and select this client that we have just created now click on Save changes now everything is done so let's click back and now we have to select the testers then click on testers and then select add testers now enter your email with which you will test this APK and add it so now my email is added now let's get back into the configuration now click on get resources and copy this text now open unity and paste it right here now open the Google Cloud platform and copy the client ID and paste it right here and click on setup okay now for the next step we have to copy the package name so let me just copy it and we have to paste it inside the nearby connection setup right here and click on setup one more time now with that our entire steps is completed and let's just wait for it to finish and now let's build our project and check that it is working or not so yes it is working it logged me in without pressing any button and yes it is showing that we are successfully logged in and it is also printing my name which is very cool and now let's upload this build into the Google Play console under internal testing and let's check it still works or not so now I have downloaded my APK from the Google Play console from the internal testing and as you can see it is saying that sign in failed and it will not work no matter how many times I pressed this button so yeah everything was just working perfectly but after uploading to the Play Store it just stopped working now why is that because whenever we upload a build in the Google Play console Google simply replaces the sha1 key that we have provided with our app due to which the new key does not match with the key that we have provided in the Google clouds platform and hence the signin doesn't work so all we have to do is just to copy the new key that Google has generated and paste it inside the Google clouds platform for that open your Google Play console and click on app sign in under setup and here you can see the key that is generated by Google and the key that is uploaded by us so all we have to do is just to copy the sha1 key that is generated by Google and paste it inside your Google clouds platform under the credentials Android client one right here now click on Save and let's try to run the game one more time and as you can see it just started working again so yeah that was it for this video Google play games login is now perfectly working now I will see you in the next video with some other topics so do like this video And subscribe to Coco 3D [Music] bye
Info
Channel: Coco 3D
Views: 19,709
Rating: undefined out of 5
Keywords:
Id: 5D-WcSXZD_U
Channel Id: undefined
Length: 13min 22sec (802 seconds)
Published: Sun Oct 01 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.