Google Play Services implementation - Unity game

Google Play Services implementation - Unity game Tags: Dev tools
on

Google Play services allow developers to implement various features related to Google Play into their games. As an example I can mention login, achievements, leaderboards, server-side saving or friends invitations. All these services can increase user engagament from playing a game and thus result in better user retention and revenues. Good user retention in your app is a possitive metrics which is surely used also by Google Play promotion algorithm.

GameArter's SDK is natively compatible with Google Play services and use them to keep all benefits going from it. It is possible by similarity and compatibility of GameArter and Google Play features. While developer sets all features and their logic in GameArter, GameArter automatically convert and transform all the settings for usage also on Google Play and other platforms. While all users data are saved still only on GameArter servers and thus developers can still access and analyze data from all platforms from one place, information about received achievements, leaderboard possitions and other features are shared with Google Play servicw and displayed in its native UI. Also users using Google Games app sees all data from their games. This all is happen automatically on background and developer does not need to do any code adjustments. Only required action is to provide access of GameArter service to his Google Play app.

Google Play services via GameArter

  • Simple implementation - by enabling access
  • Cross platform - 1 implementation for more platforms
  • User data shared between multiple platform. Users can play cross-platform - Mobile app / Web / Messenger app...

Implementation of Gaming services to Unity project

Implementation of Google gaming services means download and import Play games plugin to unity project following by request for force resolve ("Assets/Play Services Resolver/Android Resolver/Force Resolve") followed by Play Games Plugin setup.

Setup of Play Games Plugin is possible by following way: tab "Window → Google Play Games → Setup → Android Setup". Following window will be opened:

Google Play setvices configuration window in Unity
Where:
  • Constant class name: can remain default (Assets and GPGSIds)
  • Resources definitions: List of used resources.
  • Client ID: App client Id.

Getting Client ID

Client ID is necessary for communication with Google Play services. Every app has own unique client ID. On basis of selected mode, there are 2 ways to get client ID:
  1. Directly From Google Play console:
    This option require to have own Google Play developer account. Get that account require registration to Google Play console + payment of $25 fee. Once you are logged in to Google Play Console, get your app Id by following way:
    1. Go to gaming Services section
    2. Select Add new game option
    3. Fill game name and category, then press Continue.
    4. Inside the created game section, go to section "linked apps"
    5. Select Link Another app → Website
    6. Fill your app name again
    7. Fill run address with "https://api.gamearter.com/game/sdk/google"
    8. Copy got Id client code
  2. From GameArter. If you prefer to use GameArter as an official publisher of your app or game, then you get Id client code directly from GameArter system.

Once you have your unique client Id, copy and past it to client Id column.

Getting Resources definition

Resources define what features are being used by your game. You can easily imagine it as a list of associated features to your app Id. Its format is defined by used services, like events, achievements, and leaderboards. You can get the Resources format by following way:
  1. Directly from Google Play:
    Create all services in Google Play console (same as on GameArter) and the get your resources by pressing "Get resources" option at the bottom of every feature. Fill all these got resources to Resources definition space.
  2. From GameArter
    If you decided to use GameArter as Publisher, you will get the format of resources from GameArter. You will simply copy and insert it.

Once Client Id and Resources are filled, select setup and all services should start work.

Conclusion

There is no need of any automatical interaction with Google Play services from game code, all the communication is automatical, processed by SDK. Take in notice, that no all Game services features are available directly in the editor (e.g. automatical signin). In such cases, GameArter reflects expected behavior of Google Play services, but for real check and behaviour, there is need to build your app and try it on Android device.