Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unity play game service authenticate fail

I download play games unity plugin from https://github.com/playgameservices/play-games-plugin-for-unity

and run MainScene in android device

then click "Authenticate" button ,and popup google play dialog..

finally Social.localUser.authenticated is always false.

then I draw debug info in the scene below:

Createing platform-specific Play Games client
Creating real IPlayGamesClient
Entering state:ShutdownState
ShutdownState.OnStateEntered:Defaulting to no-op.
Starting Auth Transition.Op SIGN_IN status ERROR_NOT_AUTHORIZED
PlayGamesHelperObject.OnApplicationPause True
PlayGamesHelperObject.OnApplicationPause False
PlayGamesHelperObject.OnApplicationPause True
PlayGamesHelperObject.OnApplicationPause False
Invoking user callback on game thread

I try these methods to fix below, but I can't still login successfully

Method1 In the google play game console, add test user and active alpha,beta test.

Method2 In the unity,to create android keystore and signing

The keystore is a signature file that is used to sign your apk. When you create development builds Unity will not sign the apk.

You only need one Keystore file for your projects. The file is your signature. To create one do this:

In the publishing settings check the "Create New Keystore" box.

Click browse and choose a location where you want to store the file. It should be somewhere central since it's not really related to your project.

Set a protection password for the file and confirm it.

Select "Create a new key" from the "Key Alias" dropdown.

A window should open which you have to fill with your personal data about your organisation / person. The alias at the top is just a name of the keystore. If you have multiple identities make sure you choose a meaningful name. You need to set a keystore password. Note this is not the same as the protection password above. As far as i know they can be the same, but for security you should use two different. If you haven't write the passwords onto a sheet of paper ;)

Click "Create Key" to generate your keystore file.

To use a keystore for signing you have to:

Check the "Use Existing Keystore" box.

Click browse and select your keystore file.

enter your protection key.

select your desired identity from the alias dropdown.

enter the alias password in the field below

Make sure you have set your Android Market Licensing RSA Public Key at the bottom of the publishing settings. The public key has to be acquired from your Google market account.

Now create your APK file and it will be signed with your identity.

Method3 someone metioned these code is successful for them

PlayGamesClientConfiguration config = new  PlayGamesClientConfiguration.Builder().
    //.EnableSavedGames()     
    Build();

PlayGamesPlatform.InitializeInstance(config);

or

 PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder().
        .EnableSavedGames()     
        Build();
 PlayGamesPlatform.InitializeInstance(config);

Method4 I also do these check

1.Application ID in the "Android Setup" dialog matches the application ID in the Play Games Console (https://play.google.com/apps/publish)

2.The linked application package name in the Play Games Console matches the bundle id in Player Settings / Other Settings/ Bundle Identifier

3.The user that you are logging in as is added as a tester in the Play Games Console

So I stuck here,I don't know why can't authenticate sucessfully.

like image 977
敬錞 潘 Avatar asked Nov 09 '22 15:11

敬錞 潘


1 Answers

I fix my issue.

Make sure these below are the same

1.apk's sha1

2.Google Developers Console OAuth Android sha1

3.GooglePlay Developer Console link Google API ”OAuth2 client ID“ setting

like image 86
敬錞 潘 Avatar answered Nov 15 '22 08:11

敬錞 潘