• 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
1
Question by firatercis · Jul 17, 2016 at 08:34 PM · google play gamesleaderboardsocial

Can sign in using Google Play Games Plugin, but unable to load scores from the leaderboard

Hi, Before entering t$$anonymous$$s question, I searched a lot (got stuck for 2 weeks on t$$anonymous$$s problem :'( ) I only aim the google leaderboards functionality in my Unity project. I followed the following steps:

1- Integrated google play games plugin as described in: https://github.com/playgameservices/play-games-plugin-for-unity

  • Created a google play services game entry in my google play developer console and link it to my application (in the same console) with the package id com.o6systems.zray w$$anonymous$$ch is in open alpha test.

  • I created creditentials and inserted my SHA1 of the keystore / key pair to the google api console.

  • I created ac$$anonymous$$evements, 1 scoreboard and get my resources entered to the Window / GooglePlayGames/Setup / Android Setup

The keystore I used is the same that generates the SHA1 code. I entered it in the player settings and its passwords.

My package name is consistent in all platforms (in google api console, google play developer console, in unity everywhere)

I entered my test user to the test users in the console.

2- I entered the following codes for authentication in one of scripts work in my splashscreen scene:

 void Start () {
         #if UNITY_ANDROID
         ConfigureGooglePlay ();
         SignIn ();
         #endif
 }
 
 void ConfigureGooglePlay(){
 
             PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()
                 .Build();
             PlayGamesPlatform.InitializeInstance(config);
         PlayGamesPlatform.DebugLogEnabled = true;
         PlayGamesPlatform.Activate();
 }
 
 void SignIn () {
         Social.localUser.Authenticate (success => {
             if (success) {
                 Debug.Log ("Authentication successful");
                 string userInfo = "Username: " + Social.localUser.userName +
                                   "\nUser ID: " + Social.localUser.id +
                                   "\nIsUnderage: " + Social.localUser.underage;
                 Debug.Log (userInfo);
 
             //    DisplayGPScore();
             } else
                 Debug.Log ("Authentication failed");
         });
     }

3- In Game Scene, on Game over I post the $$anonymous$$gh score of the user to the leaderboard using ReportScore function

 private void OnGameOver(){
         ...
         PostScore(_gm.$$anonymous$$ghScore);
         ..
         
         DisplayGPScore ();
     }
 
     internal void LoadUsersAndDisplay(ILeaderboard lb)
     {
         // get the user ids
         List<string> userIds = new List<string>();
 
         foreach(IScore score in lb.scores) {
             userIds.Add(score.userID);
         }
         // load the profiles and display (or in t$$anonymous$$s case, log)
         Social.LoadUsers(userIds.ToArray(), (users) =>
             {
                 string status = "Leaderboard loading: " + lb.title + " count = " +
                     lb.scores.Length;
                 foreach(IScore score in lb.scores) {
                     Debug.Log("" + score.rank + ":" + score.userID); 
 
                 }
                 Debug.Log(status);
             });
     }
 
 public void DisplayGPScore(){
 
         ILeaderboard lb = PlayGamesPlatform.Instance.CreateLeaderboard();
         lb.id = ZRayGameManager.WORLD_LEADERBOARD_ID;
         lb.LoadScores(ok =>
             {
                 if (ok) {
                     LoadUsersAndDisplay(lb);
                 }
                 else {
                     Debug.Log("Error retrieving leaderboardi");
                 }
             });
     }
 
 public void PostScore(int score){
         PlayGamesPlatform.Instance.ReportScore(score, ZRayGameManager.WORLD_LEADERBOARD_ID, (bool success) => {
 
             if(success){
                 Debug.Log("High score " + score + " posted");
             }else{
                 Debug.Log("High score " + score + " could not be posted");
 
             }
 
         });
     
     }
 
 

I simplified the codes (excluded unrelated parts)

I get the following output

 I/Unity   (15970):
 I/Unity   (15970): Authentication successful
 I/Unity   (15970):
 I/Unity   (15970): (Filename: ./artifacts/generated/common/runtime/UnityEngineDe
 bugBindings.gen.cpp Line: 37)
 I/Unity   (15970):
 I/Unity   (15970): Username: RighthandedTuba240
 I/Unity   (15970): User ID: g02637898988054749692
 I/Unity   (15970): IsUnderage: True
 I/Unity   (15970):
 I/Unity   (15970): (Filename: ./artifacts/generated/common/runtime/UnityEngineDe
 bugBindings.gen.cpp Line: 37)
 I/Unity   (15970):
 I/Unity   (15970):  [Play Games Plugin DLL] 07/17/16 18:46:52 +03:00 DEBUG: Repo
 rtScore: score=100, board=CgkIppHPm-wIEAIQCQ
 I/Unity   (15970):
 I/Unity   (15970): (Filename: ./artifacts/generated/common/runtime/UnityEngineDe
 bugBindings.gen.cpp Line: 37)
 I/Unity   (15970):
 I/Unity   (15970):  [Play Games Plugin DLL] 07/17/16 18:46:52 +03:00 DEBUG: Nati
 ve Submitting score: 100 for lb CgkIppHPm-wIEAIQCQ with metadata:
 I/Unity   (15970):
 I/Unity   (15970): (Filename: ./artifacts/generated/common/runtime/UnityEngineDe
 bugBindings.gen.cpp Line: 37)
 I/Unity   (15970):
 I/Unity   (15970): User is authenticated
 I/Unity   (15970):
 I/Unity   (15970): (Filename: ./artifacts/generated/common/runtime/UnityEngineDe
 bugBindings.gen.cpp Line: 37)
 I/Unity   (15970):
 I/Unity   (15970):  [Play Games Plugin DLL] 07/17/16 18:46:52 +03:00 DEBUG: Load
 Scores, board=GooglePlayGames.PlayGamesLeaderboard callback is System.Action`1[S
 ystem.Boolean]
 I/Unity   (15970):
 I/Unity   (15970): (Filename: ./artifacts/generated/common/runtime/UnityEngineDe
 bugBindings.gen.cpp Line: 37)
 I/Unity   (15970):
 I/Unity   (15970):  [Play Games Plugin DLL] 07/17/16 18:46:52 +03:00 DEBUG: Invo
 king user callback on game thread
 I/Unity   (15970):
 I/Unity   (15970): (Filename: ./artifacts/generated/common/runtime/UnityEngineDe
 bugBindings.gen.cpp Line: 37)
 I/Unity   (15970):
 I/Unity   (15970): High score 100 posted
 I/Unity   (15970):
 I/Unity   (15970): (Filename: ./artifacts/generated/common/runtime/UnityEngineDe
 bugBindings.gen.cpp Line: 37)
 I/Unity   (15970):
 I/Unity   (15970):  [Play Games Plugin DLL] 07/17/16 18:46:55 +03:00 DEBUG: Ente
 ring internal callback for LeaderboardManager#InternalFetchCallback
 I/Unity   (15970):
 I/Unity   (15970): (Filename: ./artifacts/generated/common/runtime/UnityEngineDe
 bugBindings.gen.cpp Line: 37)
 I/Unity   (15970):
 I/Unity   (15970):  [Play Games Plugin DLL] 07/17/16 18:47:10 +03:00 DEBUG: Star
 ting Auth Transition. Op: SIGN_OUT status: ERROR_NOT_AUTHORIZED
 I/Unity   (15970):
 I/Unity   (15970): (Filename: ./artifacts/generated/common/runtime/UnityEngineDe
 bugBindings.gen.cpp Line: 37)
 I/Unity   (15970):
 I/Unity   (15970):  [Play Games Plugin DLL] 07/17/16 18:47:10 +03:00 DEBUG: Ente
 ring internal callback for LeaderboardManager#InternalFetchSummaryCallback
 I/Unity   (15970):
 I/Unity   (15970): (Filename: ./artifacts/generated/common/runtime/UnityEngineDe
 bugBindings.gen.cpp Line: 37)
 I/Unity   (15970):
 W/Unity   (15970): !!! [Play Games Plugin DLL] 07/17/16 18:47:10 +03:00 WARNING:
  Error returned from fetchScoreSummary: GooglePlayGames.Native.PInvoke.FetchScor
 eSummaryResponse
 W/Unity   (15970):
 W/Unity   (15970): (Filename: ./artifacts/generated/common/runtime/UnityEngineDe
 bugBindings.gen.cpp Line: 37)
 W/Unity   (15970):
 I/Unity   (15970):  [Play Games Plugin DLL] 07/17/16 18:47:10 +03:00 DEBUG: Invo
 king user callback on game thread
 I/Unity   (15970):
 I/Unity   (15970): (Filename: ./artifacts/generated/common/runtime/UnityEngineDe
 bugBindings.gen.cpp Line: 37)
 I/Unity   (15970):
 I/Unity   (15970): Error retrieving leaderboardi

Conclusions:

  1. The user CAN authenticate because the method Sign In() tells Authentication Successful and prints out the user information.

  2. The user CAN post $$anonymous$$s / her score to the scoreboard, because the PostScore method tells "High Score 100 posted"

  3. The user CANNOT display scoreboard scores, with an error of

W/Unity (15970): !!! [Play Games Plugin DLL] 07/17/16 18:47:10 +03:00 WARNING: Error returned from fetchScoreSummary: GooglePlayGames.Native.PInvoke.FetchScor eSummaryResponse

I can not find any setting of the scoreboard in console, to give the user access to t$$anonymous$$s scoreboard etc.

Please help!! I am stuck here for 2 weeks (but there is improvement, I was not able to sign in 3 days ago)

Comment
Add comment
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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by selim-colakoglu · Jan 29, 2017 at 01:08 PM

I have that same problem. Can you solve the problem?

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 rtejo · May 29, 2019 at 04:35 AM

I have the same problem with the latest version v0.9.64

05-28 23:26:37.205: I/Unity(18901): [Play Games Plugin DLL] 05/28/19 23:26:37 -05:00 DEBUG: Starting Auth Transition. Op: SIGN_OU**T status: ERROR_NOT_AUTHORIZED

After restart the game, it requires to re-login into Google Play Games

Anyone has solved t$$anonymous$$s problem?

Comment
Add comment · Show 1 · 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 rtejo · Jun 14, 2019 at 02:27 AM 0
Share

It doesn't work with the development key, after publish on the Alpha channel the leaderboard worked fine.

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Is there an easy way to tell if Social.ReportScore is passed a new highscore? 0 Answers

How to wait for networkfunction to return a value ? 1 Answer

Making hundreds of leaderboards with Unity built-in Social class (or Cloud Code?). 1 Answer

Google play leader board player profile not public 1 Answer

Need help, Not showing Leaderboard UI for android. 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