Documentation

GOOGLE PLAY GAMES + PLAYMAKER INTEGRATION GUIDE 

INSTALLATION GUIDE

It is necessary to have some plugins installed for the full functioning of this asset:


SETTING UP THE PROJECT TO USE GOOGLE PLAY GAMES SERVICES 

To continue using this asset you must have your game correctly configured and also the Google Play Games game project. To configure everything correctly you can follow the Setting Up Google Play Games Services guide and then see the other GitHub guide of Google Play Games Plugin for Unity in the Configure your game section without continuing with the rest, which is just coding that we are not interest us since we are going to carry out the entire process of adding achievements, leaderboards and saving in the cloud with our asset and PlayMaker.


WARNING: For Google Play Games services to work, make sure you correctly configure the Minify section of your project. Follow what it says in this section Click Here to correctly configure the reduction in the size of the application so that it does not accidentally delete the Google Play Games services when performing a build. 

GUIDE TO GOOGLE PLAY GAMES CUSTOM ACTIONS FOR PLAYMAKER

The use of these actions is simple and can be used without much difficulty, just drag and drop them into their corresponding place. In this section we will explain in depth the use of each custom action. 

Sign In Google Play Games Services 

To log in to Google Play Games use the "Sign In GPGS" action. This action is used to log in to Google Play Games, you just have to add it and the action will send an event if the user successfully authenticates or will send another event if the authentication fails. This action also initializes the Google Play Games SDK so it is not necessary to initialize it with another separate action or script.


WARNING: It is necessary to authenticate the user with this action so that all the necessary Google Play Games services are initialized, so it is recommended to call the user authentication as soon as the game has completely started. 

Sign Out Google Play Games Services 

To log out of Google Play Games use the "Sign Out GPGS" action. This action is used to log out of Google Play Games, you just have to add it and the user will log out automatically. 

Check Authentication 

This action allows you to verify if the user is authenticated in Google Play Games or not, returning a boolean value that indicates the status of the authentication and sending an event based on the result.

Get Player Info 

This action allows you to obtain and display the information of the user who is logged in to Google Play Games, such as their name, ID, and profile photo. With this action you can save the player's name in a "String" variable, the player's ID in another "String" variable and the player's icon in a "Texture 2D" variable. 

Unlock Achievement 

This action allows you to unlock a specific Google Play Games achievement, indicating its ID. It also returns a boolean value if the achievement was unlocked and sends an event if the achievement was unlocked successfully or resulted in an error.

Reveal Achievement 

This action allows you to reveal a hidden Google Play Games achievement, indicating its ID. It also returns a boolean value if the achievement was revealed and sends an event if the achievement was revealed correctly or if it resulted in an error. 

Increment Achievement 

This action allows you to increase the progress of an incremental Google Play Games achievement, indicating its ID and the number of steps you want to add. It also returns a boolean value if the achievement was unlocked and sends an event if the achievement was raised successfully or resulted in an error.

Submit Score 

This action allows you to upload the user's score to a specific Google Play Games leaderboard, indicating its ID and the value of the score. Returns a boolean value if the score was reported correctly and sends an event if the score was uploaded successfully or resulted in an error. 

Show Achievements UI 

This action allows you to display the native Google Play Games UI with the list of game achievements. 

Show Leaderboard UI 

This action allows you to display the native Google Play Games UI with the game's leaderboard. 

Save String Data to Cloud 

This action allows you to save data from a String in the Google Play Games cloud, indicating its file name (key) and value. The data will be saved associated with the user's profile and will be automatically synchronized between their devices. This action will send an event if the data was successfully saved and another if the data saving was unsuccessful.

Load String Data from Cloud 

This action allows you to load data of type String from the Google Play Games cloud, indicating the file name (key). The data will be obtained from the user's profile and automatically updated between their devices. This action will load the data obtained into a String variable and send an event if the data was loaded correctly and another if the data loading was not successful. 

Save Array Data to Cloud 

This action allows you to save data from an Array in the Google Play Games cloud, indicating its file name (key) and value. The data will be saved associated with the user's profile and will be automatically synchronized between their devices. This action will send one event if the data was saved successfully and another if the data saving was not successful. 

Load Array Data from Cloud 

This action allows loading Array type data from the Google Play Games cloud, indicating the file name (key). The data will be obtained from the user's profile and automatically updated between their devices. This action will load the obtained data into an Array variable and send an event if the data was loaded correctly, an event if the saved data could not be loaded successfully, and another if data is obtained from the cloud. 

HOW TO CONFIGURE THE DEMO SCENE TO TEST THE ASSET

This asset contains a folder called "Demo", where you can enter a test scene that is used to test the actions of the asset, just enter the scene and configure everything as shown below:

You must have previously configured your project. You must be on the Android platform and with the Google Play Games Services plugin 0.10.14 correctly configured. All these steps and settings are clarified at the beginning of this document.

Within the Scene select an object called "GPGS_Manager" and in the Input variables of the FSM, the "GooglePlayGames_ID" section establishes the IDs of the achievements and leaderboards that you want to test. If you want to test the Cloud Save features, this scene includes a test input for saving and loading a String variable. To configure this you only have to set the name of the file (key) that you want to save in the "StringData_FileName" variable that appears in the "GooglePlayGames_CloudSave" section.

This scene is highly configurable so you can try and test all the Google Play Games features that this asset brings.

As a final step, add this scene to a test build, click the File > Build Settings tab and click the Add Open Scenes button. You make an app bundle or an apk that is certified and test it on an Android device.


WARNING: The functions of this scene and the asset do not work in the editor, they only work in an Android build.