Search Unity

Google Play - Login > Do Something

Discussion in 'Android' started by Osteel, May 4, 2015.

  1. Osteel

    Osteel

    Joined:
    Jan 17, 2014
    Posts:
    59
    Hey forums. :)

    Just a quick question. I'm attempting to do a simple leaderboard button that will (if not already) log the player into Google Play and if successful, will open the leaderboards. Nothing seems to happen though. Here's the trimmed down code:

    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4. using GooglePlayGames;
    5. using UnityEngine.SocialPlatforms;
    6.  
    7. public class LeaderboardShow : MonoBehaviour {
    8.  
    9.     private string boardID = "************************";
    10.  
    11.     void Start()
    12.     {
    13.         PlayGamesPlatform.Activate ();
    14.     }
    15.  
    16.  
    17. void OnMouseUp()
    18.     {
    19.         Social.localUser.Authenticate((bool success) =>
    20.         {
    21.             if (success)
    22.             {
    23.                 OpenLeaderboard(success);
    24.             }
    25.         });
    26.     }
    27.  
    28.     void OpenLeaderboard (bool success)
    29.     {
    30.         if (success)
    31.             ((PlayGamesPlatform)Social.Active).ShowLeaderboardUI (boardID);
    32.     }
    33. }
    34.  
    Any ideas? Thanks! :)