Game Services: Settings

To use the Game Services module you must first enable it. Go to Window > Easy Mobile > Settings, select the Game Services tab, then click the right-hand side toggle to enable and start configuring the module.

iOS Setup

On iOS, game services are provided by Game Center. After you export your Unity project to Xcode, make sure the Game Center capability is enabled in the Capabilities tab in Xcode.

Android Setup

Importing Google Play Games plugin for Unity

On Android, this module is built on top of Google Play Games Plugin. Therefore you need to import it to use the module on this platform. Easy Mobile will automatically detect the availability of the plugin and prompt you to import it if needed. Below is the module settings interface after switching to Android platform if the Google Play Games plugin hasn't been imported.

Click the Download Google Play Games Plugin button to open the download page, then download the package and import it to your project. Once the import completes the module interface will be updated and ready for you to start with the configuration.

Since we're not using Google Play Games plugin on iOS, the NO_GPGS symbol will be defined for iOS platform automatically after the plugin is imported in order to disable it.

Setup Google Play Games

To setup Google Play Games plugin, you need to obtain the game resources from the Google Play Developer Console.

The game resources are available after you configured your game on the Google Play Developer Console. If you're not familiar with the process, please follow the instructions on creating a client ID, as well as leaderboards and achievements.

To get the game resources, login to your Google Play Developer Console, select Game services tabs then select your game. Next go to the Achievements tab and click on the Get Resources label at the bottom of the list.

Copy all the xml content from the Android tab.

Go back to Unity, in the GOOGLE PLAY GAMES SETUP section, paste the obtained xml resouces into the Android XML Resources area, then click Setup Google Play Games.

You can optionally provide a Web Client ID before setting up Google Play Games if needed.

After the setup has completed, a new file named EM_GPGSIds will be created at Assets/EasyMobile/Generated. This file contains the constants of the IDs of all the leaderboards and achievements in your Android game.

Within the GOOGLE PLAY GAMES SETUP section there're other settings including:

  • GPGS Debug Log: check this to enable Google Play Games debug log.
  • GPGS Popup Gravity: use this to control the position of Google Play Games popups (e.g. achievement popup).

Auto Initialization

Auto initialization is a feature of the Game Services module that initializes the service automatically when the module starts. Initialization is required before any other actions can be done, e.g. reporting scores.

During the initialization, the system will try to authenticate the user by presenting a login popup.

  • On iOS, this popup will show up when the app gets focus (brought to foreground) for the first 3 times. If the user refuses to login all these 3 times, the OS will ignore subsequent authentication calls and stop presenting the login popup (to avoid disturbing the user). Otherwise, if the user has logged in successfully, future authentication will take place silently with no login popup presented.
  • On Android, we employ a similar approach but you can configure the maximum number of authentication requests before ignoring subsequent ones.

You can configure the auto initialization feature within the AUTO-INIT CONFIG section.

  • Auto Init: uncheck this option to disable the auto initialization feature, you can start the initialization manually from script (see the Scripting section)
  • Auto Init Delay: how long after the module start that the initialization should take place
  • [Android] Max Login Requests: maximum number of authentication requests allowed on Android, before ignoring subsequent ones (in case the user refuses to login)

"Module start" refers to the moment the Start method of the module's associated MonoBehavior (attached to the EasyMobile prefab) runs.

Leaderboards & Achievements

This section provides a guide to manage leaderboards and managements for your game.

Before You Begin

It is assumed that you already configured your game for the targeted gaming networks, i.e. Game Center and Google Play Games. If you're not familiar with the process, here're some useful links:

In the LEADERBOARDS and ACHIEVEMENTS you can add, edit or remove leaderboards and achievements.

Adding a New Leaderboard or Achievement

To add a new leaderboard click the Add New Leaderboard button (or Add New Achievement button in case of an achievement).

A new empty leaderboard (or achievement) will be added.

Fill in the required information of the leaderboard (or achievement):

  • Name: the name of this leaderboard (or achievement), this name can be used when reporting scores to this leaderboard (or unlocking this achievement)
  • iOS Id: the ID of this leaderboard (or achievement) as declared in iTunes Connect
  • Android Id: the ID of this leaderboard (or achievement) as declared in Google Play Developer Console

Google Play Games' leaderboards and achievements have generated IDs which can be difficult to memorize and cumbersome to copy-and-paste, especially if there are many of them. Thankfully, when you setup Google Play Games, the constants of these IDs are generated automatically (remember that EM_GPGSIds file?), allowing Easy Mobile to show a nice dropdown of all defined leaderboard and achievement IDs for you to choose from.

Removing a Leaderboard or Achievement

To remove a leaderboard (or achievement), simply click the [-] button at the right hand side.

Arranging Leaderboards or Achievements

You can use the two arrow-up and arrow-down buttons to move a leaderboard (or achievement) upward or downward within its array.

Constants Generation

Constants generation is a feature of the Game Services module. It reads the names of all the added leaderboards and achievements and generates a static class named EM_GameServicesConstants that contains the constants of these names. Later, you can use these constants when reporting scores to a leaderboard or unlocking an achievement in script instead of typing the names directly, thus help prevent runtime errors due to typos and the likes.

To generate the constants class (you should do this after adding all required leaderboards and achievements), click the Generate Constants Class button within the CONSTANTS CLASS GENERATION section.

When the process completes, a file named EM_GameServicesConstants will be created at Assets/EasyMobile/Generated.

results matching ""

    No results matching ""