Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
2
Question by TusharVaid30 · Feb 06, 2019 at 03:48 PM · unity 5physicsgoogle playgoogle play games

Google Play Game Services not working in Unity

I created a game using Unity and now I want to add Play Services in my game. I have uploaded the game on the Google Play Store from the Console, downloaded the play services plugin from GitHub, added it in my Unity project, installed Google Play Services tools from the SDK Manager, created the achievements and the leaderboard and copied the resources to Unity. I even copied the SHA-1 from the Upload Certificate to the Google API credentials. In short, I did every solution I could find on Google. The problem is...

 private void SignIn()
     {
         Social.localUser.Authenticate((bool success) =>
         {
             if (success)
             {
                 Destroy(testObject);
             }
             else
             {
                 Destroy(testObject2);
             }
         });
     }


None of these objects are destroyed. Thanks in advance.

Comment
Add comment · Show 4
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Chik3r · Feb 06, 2019 at 09:21 PM 0
Share

Text is better than a screenshot. Also, where are you calling SignIn()?

avatar image TusharVaid30 Chik3r · Feb 07, 2019 at 03:45 AM 0
Share

@chiker In the Start method.

avatar image Chik3r TusharVaid30 · Feb 07, 2019 at 01:52 PM 0
Share

It doesn't work on the Editor, or on Android?

Show more comments

4 Replies

· Add your reply
  • Sort: 
avatar image
7
Best Answer

Answer by TusharVaid30 · Feb 10, 2019 at 09:58 AM

I found the solution. Go to your Publishing Settings tab in the Player Settings. and set the options like this.....

alt text

Then open the proguard-user.txt file and type in this....

 -keep class com.google.games.** { _; } 
 -keep interface com.google.games._* { *; }

Save it and it will surely work.


annotation-2019-02-10-152546.jpg (16.8 kB)
Comment
Add comment · Show 5 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image rpuls · Sep 12, 2019 at 09:03 PM 0
Share

Hey, are those lines supposed to be exactly like that? with the - at the line start? I'm facing the same issue, ticking the proguard option generated two proguard-user.txt files, I pasted both lines in both of the files and saved, but now I'm stuck with build errors:

 No type signature, but name is not <fields> or *
avatar image MiroslavShard · Apr 06, 2020 at 09:20 PM 0
Share

Thanks a lot! You are really a genius! The big problem is that in the official Google Play Services documentation there is no solution to this problem. Can you please explain how this works?

avatar image ladipupo6 · Jul 30, 2020 at 10:13 AM 0
Share

Hello. This works but after showing "Connecting to Google play games", it disconnects and doesn't sign in. What can I do please?

avatar image Clicksurfer · Dec 14, 2020 at 12:18 PM 0
Share

This is the right approach, but it didn't work for me (Unity 2020.1.3f1). Adding the following to the proguard-user.txt file solved the issue for me:

  -keep class com.google.games.** { *; }
  -keep interface com.google.games.** { *; }
  -keep class com.google.unity.** { *; }
 
 -keep class com.google.android.gms.games.multiplayer.** { *; }
 -keep class com.google.android.gms.games.leaderboard.** { *; }
 -keep class com.google.android.gms.games.snapshot.** { *; }
 -keep class com.google.android.gms.games.achievement.** { *; }
 -keep class com.google.android.gms.games.event.** { *; }
 -keep class com.google.android.gms.games.stats.** { *; }
 -keep class com.google.android.gms.games.video.** { *; }
 -keep class com.google.android.gms.games.* { *; }
 -keep class com.google.android.gms.common.api.ResultCallback { *; }
 -keep class com.google.android.gms.signin.** { *; }
 -keep class com.google.android.gms.dynamic.** { *; }
 -keep class com.google.android.gms.dynamite.** { *; }
 -keep class com.google.android.gms.tasks.** { *; }
 -keep class com.google.android.gms.security.** { *; }
 -keep class com.google.android.gms.base.** { *; }
 -keep class com.google.android.gms.actions.** { *; }
 -keep class com.google.games.bridge.** { *; }
 
 
 -keep class com.google.android.gms.common.ConnectionResult { *; }
 -keep class com.google.android.gms.common.GooglePlayServicesUtil { *; }
 -keep class com.google.android.gms.common.api.** { *; }
 -keep class com.google.android.gms.common.data.DataBufferUtils { *; }
 -keep class com.google.android.gms.games.quest.** { *; }
 -keep class com.google.android.gms.nearby.** { *; }
 
  -dontobfuscate
avatar image antoniocvnunes · May 22, 2021 at 11:22 PM 0
Share

Thank you very much! When I changed the values of Release and Debug to None, it started to work the sign in on Google Play Games. You really helped me! Thanks!

avatar image
2

Answer by mhhk88 · Jun 07, 2019 at 07:11 AM

@TusharVaid30 I don't know how to thank you for your solution. It fixed my problem which has harassed me for the last 10 days. God bless you !!!!!!!

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image TusharVaid30 · Jun 07, 2019 at 08:53 AM 0
Share

@mhhk88 You're welcome. I am glad it worked out. Good Luck with your project.

avatar image UDN_1fb6f943-d639-43c7-816c-76367e5e91b7 · May 02 at 07:48 PM 0
Share

Same for me... he is lifesaver... let's give him a cookie !

avatar image
1

Answer by RigbySug · Feb 07, 2019 at 12:59 PM

Same problem can you help us guys?

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by Chik3r · Feb 09, 2019 at 06:32 PM

For Google Play Games to work on Android, you have to first configurate and activate PlayGames. Here's how you do it:

 PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()
             .Build();
 PlayGamesPlatform.InitializeInstance(config);
 PlayGamesPlatform.Activate();
 PlayGamesPlatform.DebugLogEnabled = true;

And then you sign in.

How it would look in the start method:

 void Start() {
     #if UNITY_ANDROID // Only run on android, because it's not needed for iOS
     PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()
         .Build();
     PlayGamesPlatform.InitializeInstance(config);
     PlayGamesPlatform.Activate();
     PlayGamesPlatform.DebugLogEnabled = true;
     #endif
     SignIn();
 }
 
 private void SignIn()
 {   
     Social.localUser.Authenticate((bool success) =>
     {
         if (success)
         {
             Destroy(testObject);
         }
         else
         {
             Destroy(testObject2);
         }
     });
 }
Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image TusharVaid30 · Feb 10, 2019 at 07:58 AM 0
Share

I have done all of this, but it doesn't work.

avatar image tangyinglin0228 · Jul 20, 2021 at 01:54 AM 0
Share

I have the same problem and I found what I did wrong. If you use the plugin, you need to use PlayGamesPlatform.Instance namespace code other than the Social. namespace code. Or the Play Games login won't even pop, yet it does pop if you check Development Build which would be confusing. Hope this would save time for those who come after me

If you use the plugin on github, change this line

 Social.localUser.Authenticate((bool success) =>

to

 PlayGamesPlatform.Instance.localUser.Authenticate((bool success) =>


Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

266 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Android - Error building Player: CommandInvokationFailure: Failed to re-package resources 0 Answers

Signing into Google Play Game Services Crashes App 0 Answers

Problem with Google Play Game Services: Invalid Classname 1 Answer

Google play authentication failed after adding keystore 0 Answers

Unity Google Play Service Plugin Social.localUser.Authenticate(…) App Crash 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges