Skip to main content

UNITY: Local login with Unity (Android)

I found myself a lot of log in problem with Unity. And I finally found the solution, thanks to stackoverflow.com, https://github.com/playgameservices/play-games-plugin-for-unityUnity course I had attended.
Here is step by step need to be done.

Let's get HEADACHE

1) Create a project apk out from Unity Engine.

- When you want to start create create an apps from Unity Engine, please do not import Play Games Service yet. Do it after you upload apk file to Google Play Console.
- Make sure Package Name had been changed.

- Create a keystore if don't have.
- Build your android apps

- After build, it will open a folder with a apk file. 

2) Upload to Google Play Console Alpha Test.

- Go to https://play.google.com/apps/publish (If you can't get in, please purchase Google developer license with Gmail Account)
- Create new application

- Enter title name and start create. (may need wait a while for google to create a new application for you.
- After success, you will be auto redirect into application settings. If not, just choose your application from the list.
- Choose App releases on left side, and click on Manage Alpha as below. Then click Create Release.

- Just Enrol to get Google Play App Signing.

- Now, start upload your apk file.

- Once done upload, click All Application on top left list to back to main menu. 

3) Create new Game Service and link to uploaded application



- Key in game name and choose game type and click Continue. (May need to wait few minutes)
- In linked apps, choose Android.

- Choose your upload package name and click Save and continue at top.


- Next step is to Authorize your app



- Do not change anything below, the "Signing certificate fingeprint" should be auto generated for you base on your selected package apps. Click Confirm.


- here is the funny part. Not sure why but it is a must to create one of Events / Achievements / Leaderboards. For me, i only create a leaderboard.

- After create, you will see like below. Click on Get Resources.


- You will get resources like below. This will be used to setup in Unity.

<?xml version="1.0" encoding="utf-8"?>
<!--
Google Play game services IDs.
Save this file as res/values/games-ids.xml in your project.
-->
<resources>
  <string name="app_id">149010035409</string>
  <string name="package_name">com.TooTiToo.GameOverDefender</string>
  <string name="leaderboard_top_score">CgkI0eXCjasEEAIQAA</string>
</resources>

- Go to Testing and be sure tick on Alpha Testers and Add Testers email as you want.




4) Import Play Games package into Unity and start setup setting.

- Download latest version from the link below and unzip it. You will find a *.unitypackage inside "current-build" forlder.

- In Unity, Click Assets => Import Package => Custom Package and choose the play-games-plugin-for-unity-?.?.??.unitypackage
- Import all of it.

- After finish import, you will be unable to build apk file until finish setup settings.
- In Unity, Click Window => Google Play Games => Setup => Android Setup...
- Copy and paste the resources you just get from Google Game Service.

- Click setup and you have done all the settings. Now you can start build a login test.

5) Google Play Sign in can only be tested in mobile phone only

- create a script and try test login as below.

using GooglePlayGames;

void Start () {
PlayGamesPlatform.Activate ();
Social.localUser.Authenticate((bool success) => {
//Do something depending on the success achieved
if (success){
}else{
}
});
}

- Build the apk and install into mobile phone. When it success log in, you will see the your account pop up at the top of your screen.

================================================================

UPDATE (This is still not confirm when do not need to do this)

6) Update Google API Settings 

-  Due to some reason, we are unable to sign in when download apps from Google Play Store, I update here a bit for solution.

- Go to https://console.developers.google.com. Select your game service that you had created as below.


- Next Go to Credential. You will see the your OAuth2.0 client IDs. Click on edit icon.


- Here you will got your "Signing-certificate fingerprint". For me, it is wrong. we should change it.


- Now go to https://play.google.com/apps/publish
- Select your Game in All Application. (Not Game Service)
- Find "App Signing". And copy SHA-1 under App Signing certificate. and replace "Signing-certificate fingerprint" as above image and save it.

- Now your release product should be able to sign in.




Hope this can help those who failed in Google Play sign in.

Comments

  1. YouTube vr : VideoOdds - videodl.cc
    VideoOdds - vr. YouTube vr. YouTube vr. YouTube vr. YouTube vr. YouTube vr. YouTube vr. YouTube vr. YouTube vr. YouTube vr. YouTube youtube to mp3 converter android vr. YouTube vr. YouTube vr. YouTube vr.

    ReplyDelete
  2. Where is The Star Grand at The Star Gold Coast?
    The 메리트바카라 Star Grand at The 가입머니주는사이트 Star Gold Coast is located in the suburb of Broadbeach, and 라이브스코어 is open daily 24 hours. 포커 디펜스 The Star 문페이 Grand at The Star

    ReplyDelete

Post a Comment