GOOGLE PLAY GAMES + PLAYMAKER INTEGRATION GUIDE
INDEX
It is necessary to have some plugins installed for the full functioning of this asset:
Have the Google Play Games SDK installed in version v2.0.0. Download here
Have the External Dependency Manager installed to resolve common errors working on Android. It comes by default with the SDK, but if you want to install it manually Download it here
Have the PlayMaker asset installed to use Google Play Games Services with visual scripts.
Install the asset from the package manager and start with the remaining configuration.
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 check out the other guide for the Google Play Games plugin for Unity. Without continuing with the rest, which is just code and doesn't interest us, we'll be completing the entire process of adding achievements, leaderboards, and cloud saving with our resource 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.
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.
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.
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.
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.
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.
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.
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.
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.
This action allows you to display the native Google Play Games UI with the list of game achievements.
This action allows you to display the native Google Play Games UI with the game's leaderboard.
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.
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.
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.
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.
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 v2.0.0 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.