Search Unity

Can't get ShowAchievementsUI(); to show anything

Discussion in 'Android' started by CB-InDev, Jul 16, 2014.

  1. CB-InDev

    CB-InDev

    Joined:
    Apr 4, 2014
    Posts:
    11
    Hello everyone, I have been following a few tutorials on implementing the Google Play Game Service plugin into Unity. After a few missteps, I seem to have finally corrected the installation, as the game plays exactly like it did before.

    However, when I try to call the ShowAchievementsUI(), nothing pops up. At this point I think there may just be some small things I missed like copying certain files over into the right directory. I did manually put the Google-play-services folder from the SDK into my Unity Plugins/Android folder.

    Code (CSharp):
    1.    
    2. void OnGUI()
    3.     {
    4.         GUI.skin = Resources.Load("GUISkin") as GUISkin;
    5.         if(GameObject.FindGameObjectWithTag("Blocker") == null)
    6.         {
    7.             if (life == 4)
    8.             {
    9.                 Social.ReportProgress ("achievementID", 100.0f, (bool success) => {});
    10.                 Social.ShowAchievementsUI();
    11.             }
    12. ...
    13.  
    Am I allowed to call Social.ShowAchievementsUI() within OnGUI()? I can't seem to figure out what else can be wrong.
     
  2. Agent_007

    Agent_007

    Joined:
    Dec 18, 2011
    Posts:
    899
    Did you test out the minimal sample project?
     
  3. CB-InDev

    CB-InDev

    Joined:
    Apr 4, 2014
    Posts:
    11
    I did, it turns out the issue was with a conflict from a previously installed Google Mobile Ads plugin. I deleted all the files/folders from each plugin, re-installed them, and did the Android setup again and it worked.

    Some lessons learned, for hopefully the next person if they run into these issues:
    1) If the authenticating ends instantly without success, make sure you have PlayGamesPlatform.Activate() called in your Start() function.
    2) If your game crashes instantly, there could be a conflict in the plugins you have and the code you are running. I had a conflict since I manually put in the google-play-services-lib folder into plugins, but the official Google Play Unity plugin actually copies the latest files manually.
    3) If the authenticating process loops forever it could be because the google-play-services-lib folder in Plugins is incorrect, let the Asset install it automatically (don't overwrite any folder or add any folders)
    4) If the authenticating process loops forever, you could have the wrong App linked in Google Developer Console.

    Hopefully these hints help, I ran into some of these problems and found it relatively easy to fix. I just wanted to document them in case someone else was running into similar issues.

    Hope this helps!
    ~CB-InDev
     
    iXtremeMIKEL likes this.