5

GPG Tutorial – Saved Games (Code)

This post contains all the code that’s been written in the YouTube video.

You can read it at your own pace, although watching the video prior to looking at this code example is recommended.

PlayGamesScript.cs

 

CloudVariables.cs

 

ManagerScript.cs

 

UIScript.cs

 

Matej Rešetár
 

Matej is an app developer with a knack for teaching others. If he's not programming, making tutorials or doing other business, he's mostly working out, listening to audiobooks and taking cold showers.

  • LoomaBox says:

    Thank you VERY MUCH for the Tutorial!!! It is GREAT!!

    Immediately after playing my game in Unity the Console shows the following error:

    NullReferenceException: Object reference not set to an instance of an object
    ManagerScript.Start () (at Assets/Scripts/ManagerScript.cs:14)

    and line 14 refers to: UIScript.Instance.UpdateHighscoreText(); in the void Start()

    it looks like the function returns “null”…

    Another silly thing is that my Highscore does not get back if I stop and start again neither in Unity nor on device. I also doubt if the highscore ever gets saved on the cloud.

    What would you recommend to troubleshoot?

  • Marinos says:

    Same here do you have any solution?

  • João says:

    hi

    great tutorial, but i have a problem.
    my app (in internal testing), if i just add EnableSavedGames(), crashes after login.
    i already enable savegames in the google console.

    do you have any ideas? i’ve search all over the internet and i can’t find a answer.

  • ali says:

    I want to other variable eg. level

    How i add level,health eg. variables?

  • >