Search Unity

Google Play Services>Help> Loading screen before show Leaderboards UI.

Discussion in 'Scripting' started by guimcandido, Sep 16, 2014.

  1. guimcandido

    guimcandido

    Joined:
    Mar 6, 2014
    Posts:
    4
    I have a button that activates a loading object and the UI of Google Play Services, the UI displays the rank and achievements of the player etc. I use this command to display the UI: "Social.ShowLeaderboardUI ();".
    The problem is that to show the UI takes a while and during this time the game keeps rolling.
    What I want to do is disable the loading screen when the UI loads, but I do not know how to recognize the moment when the UI loaded.

    Can anyone help me? - Sorry for the grammatical errors, english is not my native language.
    Guilherme M.

    Thank you.
     
  2. Ian094

    Ian094

    Joined:
    Jun 20, 2013
    Posts:
    1,548
    I've used Google play services in an android game before and I don't think there is a way to check whether the UI has loaded.

    I think the application is paused when viewing the UI so you could take advantage of the "OnApplicationPause" function.

    You can try something like this :

    Code (JavaScript):
    1. var loadedUI : boolean;
    2.  
    3. function Update(){
    4. if(loadedUI){
    5. //Disable Loading
    6. }
    7. else{
    8. //Enable Loading
    9. }
    10. }
    11.  
    12. function OnApplicationPause(onPause : boolean) {
    13. loadedUI = onPause;
    14. }
     
    guimcandido likes this.
  3. guimcandido

    guimcandido

    Joined:
    Mar 6, 2014
    Posts:
    4
    Thank you so much! I will try it tomorrow and I'll be back to tell if it worked.

     
  4. guimcandido

    guimcandido

    Joined:
    Mar 6, 2014
    Posts:
    4
    Thank you for the solution, it worked!
     
  5. Ian094

    Ian094

    Joined:
    Jun 20, 2013
    Posts:
    1,548
    Awesome. Glad I could help.
     
    guimcandido likes this.