How to Import and Integrate Google Play Services in unity | 2019 | Latest

How to Import and Integrate Google Play Services in unity  | 2019 | Latest


Hello everyone welcome back this channel in
this unity tutorial I will show you how to integrate Google admob and Google Play services
and your application in Unity this is the game which we have been recreated on this
channel and if you want to know how to create this game you can find the link in the top
right corner and if you want to learn more about game development you can watch other
videos on this channel In this video I will show you how to integrate Google Play services
in unity and in the next video I will show you how to integrate Google admob in unity
So without delay let’s start the video **Unity 2D Tutorial. Inside Unity first you have to switch the
platform to Android Click file build setting Android and switch platform to use Google
Play services in your application you have to download the package You to have to go
to github you will get the link in the description and you have to click on clon or download
you have to download the zip file from here after downloading the zip file you can go
to the current build folder inside the folder you will get the package which is released
recently by the Google and to use Google Play services you have to import it in your application
so lets import the package we have to import the whole package click on import now it will
take some time to use Google Play services you should have the Google Play console account
you will get this link from the description and after opening the Google Play console
account you have to click on Game Services then add new game you need to write the name
of your application I will write YouTube test and you have to select the category I will
choose educational and after that you need to click on continue you can write the description
here and if you want to save games you can change it to on save it now click on leaderboard
on the left hand side Add leaderboard Now you need to write the name of the leader board
I will write high score I want the value in numeric now click save now if you want to
add achievement in your application you can click on achievement now add achievement now
you have to write the name of the achievement I will write high score achievement Now click
on save now click on testing on the left side NOW CLICK ON ADD TESTER Now inside this you
have to write that id from which you have to test this application now click on add
and after this you need to click on linked app I am creating an Android application so
I will click on Android Inside the package name you have to write the package name now
go to Unity you will get this dialogue box hit ok now click enable now the Google Play
services is successfully imported in our application you can right click on any folder go on Play
services resolver Android resolver then resolve now after this we have to make some changes
in the publishing setting go on file build setting then Player setting now in the right
side you will see other setting and inside this you have to change the package name I
will write com. Youtube.test and I will change install location
to force internal now inside the publishing setting we have to create a new key I will
click on create a new key and I will click on browse key store now we have to save the
file in our computer I will create a new folder for that and I will name it Google Key I will
save this file inside this folder now enter the password and you have to remember this
password now click on Unsigned key and create a new key inside this box you have to fill
the Aliace name password you have to confirm your password you need to write the first
and last name and organisational unit I will fill this quickly after this you need to click
on create key Now select the key which you have just created and enter the password now
this step completed now we have to open the command prompt and inside this we have to
write a command I will provide this command in the description now inside this double
quotes you have to write the destination of the KeyStore file I will go in that folder
where I have saved the Google key open the folder I will copy the destination Using control
+ c and I will paste inside this using the right mouse button now we have to write the
filename along with the extension I will copy the file name and paste it inside this press
enter Now we have to enter the password press enter we need this line of code in the Google
Play console now open the Google Play console inside the package in we have to enter the
package name copy package name from other settings and I will be past here I will click
on save and continue now we have to paste certificate open cmd Select it using the left
mouse button and press enter to copy the text. Paste it using Ctrl V .Now click confirm. This process is complete . Click learderboard
Get resources Select and copy this text and paste in unity Now Switch to unity Go on window
GPS Setup android setup Paste it using Control V now click setup Hit ok . Google pay services
is integrated in our application now we have to write the script to use the Google Play
services I have already created a package for this you will get the link of this package
in the description open this package in unity and click on import inside the package you’ll
find two script let’s open gps.in editor now we have uncomment this code to uncomment the
code Press control A control k and control U this wil uncomment the code save it let’s
go to the script once I have created a point Variable which is of int type I have also
created a text variable I have created two variable one is leaderboard and other achievement
we will provide these value in inspector and inside the start we initial is the Google
Play services and in the login method first we authenticate the user and if we are able
to sign in in Google Play services this line of code will run else this line of code will
run and to Show Leader about I have created on show leaderboard method to show a specific
leaderBoard we have to provide that leaderboard ID inside this I have created add score to
learderBoard method method so that we can provide score to leaderboard and inside this
first we will check if we are login in Google Play services or not and if we are sign in
Google Play services then we will provide the point to the learderboard and if we are
able to add the score to the leaderboard this line of code will run else this will run to
show the achievement I have created a reward achive method inside this you have to provide
the achievement ID and the point which want to add I have also created a morePoint Method
this will increase the point which will provide to the leader board and to logout from the
Google Play services I have created on logout method Now lets go to Unity I will create
an Empty game object I will create few button inside this now I will create an Empty game
Object I will drag and drop the GPS script inside the point text I will drag and drop
the text and for the leaderboard and achievement I will go on Window Google Play services setup
and we have to copy the string after the leaderboard and paste it in the leaderboard field and
for the achievement I will select and copy the achievements string and paste it inside
the achievement field now let’s go to the method and assign different function to that
now we have to assign different method to this button login will call the login method
leaderboard will call the method achievement will call the achievement method and add point
will call the more point method I will create one more button this will add this score to
the leaderBoard Now lets build this application for my phone open this came on my phone and
see if all the thing is working or not. I am able to sign in Google play services
and I am able to see the leaderboard in next Video we will will learn how to integrate
admob in this game and if you like this video don’t forget to hit the like button and subscribe
to this channel to see more game related content see you in the next video. **admob and google play services tutorial
end**

Leave a Reply

Your email address will not be published. Required fields are marked *