Publish a game on Google Play. Set up Play Games Plugin for Unity

Published on March 05, 2018

Publish a game on Google Play. Set up Play Games Plugin for Unity

Hello! I decided to share my experience in adding a game to the Google Play Console and setting up the Play Games Plugin for Unity.

We'll start by setting up Unity.

Unity setup


First you need to download and install Play Games Plugin.

To do this, follow this link , download the repository, go to the current-build folder, open GooglePlayGamesPlugin and install it. After that, Google Play Games should appear in the Windows tab .

image

And such a window should appear

image

Before creating the build, you will need to change a couple of settings in Player Settings. Go to Edit -> Project Settings -> Player.

In the Other Settings tab, specify the following fields:

  1. Package name: Package name of your future game
  2. Version: Application Version
  3. Bundle Version Code: Based on it, Google Play determines which version of the application is newer. It will not be displayed to users.

Next, go to the Publishing Settings tab.

Here we need to create a keystore, (more about keystore here and here is a little shorter ).

  1. Select the check box Create a new keystore
  2. Choose Browse Keystore
  3. Set a name, save
  4. Fill in the password fields

After that, you will need to create Alias:

  1. Click on Alias, select Create a new key
  2. Fill in the fields, click Create key
  3. Choose our Alias ​​key that we just created

image

About Aliases
Aliases
Keystore (at least in JKS format), allows you to store several pairs of keys and certificates. An alias is used to identify each pair or individual certificate. The alias is specified in the source code when accessing the corresponding key or certificate. Access to each alias is limited by password.

Now, every time before creating a new build, you will need to go into these settings and enter the passwords for the keys, so keep the keys in a safe place, in case of loss there will be big problems with recovery.

More details about all the settings can be found on the Unity page .

If such a window appears after creating the build, then do not worry, after setting up the Google Service we will return to Unity.

image

Setting up Google Play Console


To begin with, we will need to purchase a Google Developer Account, it costs $ 25. Suppose we already bought it.

We open the link to the Google Play Console.
Go to the All applications tab, click New application, enter a name, choose the language of the future application, click create.

image

After creating the application, a page with your application opens.
Here you will need to fill out all the necessary fields so that you can publish the application. You can just point to the triangle, and it will tell you what you need to fill out.

image

After filling in all the necessary fields, we go to the Application Versions tab,
here you decide at what stage your application is, and based on the selection, go to the management tab, in my case it is Alpha testing.

image

Here we choose to create an issue, connect the Google Play App Signing in the next window (if it appears). We select our apk file, after downloading the file, Google should automatically tighten the version of the application, and the bundle number (the settings that you specified before creating the build) as shown in the screenshot.

image

And the last thing you need to do before creating the release is to fill in the “What's new in this version” field (do not delete the language tags when filling out). We click to look, there should be a warning of this type:

image

Okay, you need to add testers before publishing the application, you can do this in the settings. We leave the application’s tab, on the main page, select Settings, go to the Testers tab and add a list (just specify the mail).

image

Return to your application, click on Management, then choose what testing will be, open or closed, select your list of testers, click save.

We return to the Application Versions page, click on change version, everything is saved what you did before (including your apk what you downloaded), just click on browse, and clicks publish (before publishing, make sure that the application is ready for publication, otherwise you will be invalid publish button)

image

After that, the project should go to the stage of preparation for publication, you will need to wait a couple of hours until our application is checked.

image

In the meantime, we’re going to check on the setting up of game services.

Game Services Setup


Game services allow you to add leaderboards, cloud saves, achievements, quests, etc. to the game.

We go to the main page, go to the Game Services tab, click add game, make sure you choose not to use the Google API yet, click continue.

image

Here we will need to bind the game that we downloaded earlier to the service that we just created. We go to the Related Applications tab and select the platform (in my case, Android), when you click on the package name, your game should appear, select it, twist a little lower, and select the settings that you need, then save it.

image

After that, you must authorize the application, click authorize and confirm, a little later I will talk about it.

image

If you want to use cloud saving, go to the Game Details tab and there, after the game description, there will be the Saved Games option, turn it on and save the changes (after choosing this option, it cannot be changed after the service is published), scroll down to the end and enable the Google Drive API.

Now you can add what you want, in my case I will add one leaderboard.
After you have done / added everything, go to the Publish tab, it will indicate what you have not done yet, click publish game.

Again, you will need to wait a couple of hours.

After publication


After your game is published, you can find it on the Google Play page, and we will also need to send a link to our app for testers.

image

To do this, go to Release Management, Application Versions, expand this window

image

and see the link that you need to send to testers, click on it.
Here we have a window in which we will have to agree to test our application, click Participate in testing.

image

After that, a window should appear that you have become a tester, the page will contain links from where you can download the application.

image

Now you can download your application and test it.

Tip: To quickly go to your application page on Google Play, point to the information icon to the right of the name of your project and click Find on Google Play.

image

Well, you can now download your application from Google Play. The next step is to update the application.

Application update


Let's say we changed something in the application, and now we want to update the version of the application on Google Play.

For this, in Unity, we must change the Bundle Version Code (it is not necessary to change the application version), and enter the passwords for the keys that were created before.

image

image

After creating the build, go to the Google Play Console, open the application that we want to update, go to Release Management -> Application Versions -> go to Management, select Create release in the upper right corner, load our apk, fill in the What's New field (you can copy from the past version). The version code is taken from the Bundle Version Code, in my case it is 2.
Click save, after View and click publish.

image

After the update, you will have to wait about 30 minutes before the application is published. After updating the application, the new version should be tested on 10 devices, you can watch in real time how the testing is going, watch the video with the launch, and read the logs. To do this, go to the application -> Release Management -> Test Report. Here you will find a list of phones that are being tested, and monitor the status of the passage.

image

To watch the launch video, select a device where testing has already completed, after which a window with the phone’s characteristics should open, and the video.

image

ps A month ago, you could watch the logs under the video, who knows where Google got them?

It usually takes me about 20 minutes to test, after which you still have to wait 10-15 minutes before publishing on Google Play. By the way, be careful if you download several versions in a row, it’s not the fact that the version you are downloading is the latest, my advice after publication can be safely wait about an hour before testing.

Speeding up testing


Agree, if you are testing Google Play Services, then the whole way from downloading to downloading takes a decent amount of time (about 40 minutes), which is not at all pleasing. I myself went this way when I did support Google Play Services, it was very painful after each small change to wait 40 minutes to test it. Like watching a video about cloud saving, I saw Nox applications ( link, I hope they will not be considered advertising), which emulates Android perfectly, you just create a new version of the application, install it in Nox, and that’s it, you can safely test it, bypassing 30 minutes of time, is it really good? But there’s another catch, Google Play services will not work if you didn’t download the application from Google Play, but you can easily get around it, I also came across this in the video about cloud saving.

And so, let's go, go to the application -> Release Management -> Application Signatures, then 2 sets of certificates will open in front of you, you need the SHA1 certificate from the Certificate Download section, copy its value.

image

Now you need to change the value of the certificate in the Google API, for this we go to the Game services, select the one to which your application is attached, open the Game Information, scroll to the bottom of the page and see the link, click on it (thanks to Google for such a cool design, sometimes it takes a few minutes to find the link).

image

This page will open, here we are interested in the Credentials section.

image

image

Open our account and change the SHA1 value of the certificate to the one that you copied before, and save.

image

Important! Remember to change the value of the SHA1 certificate to the one from the Certificate to sign the application before publishing the release version. Otherwise, services will not work for users.

image

Now we have reduced our testing to 5-7 minutes, a good result!

Finish with setting up Unity


After we have done everything in the Google Play Console, we can return to Unity and finish our settings.

To get started, open the Google Play Console and go to Game Services, and open something from what we created (for example, player ratings) and see “Get Resources” there, click on it, copy everything in the Android tab, and open Unity.

image

Open Unity, go to the Window -> Google Play Games -> Setup -> Android setup tab.

image

Such a window should appear.

image

We indicate where we will save the class and the class name, paste what we copied before, and click Setup, should a window will appear stating that the setup was successful.
That's all, now in this class there are constants with id-shnikov of things that we created.

In the end, I decided to duplicate all the links that were in the article, as well as give links to videos that would be useful when setting up Google Services in the code.

  1. About keystore
  2. About the same, only shorter
  3. Android Player Settings official Unity page
  4. Google play console
  5. Play Games Unity Plugin

  1. Useful links for Google Service:
  2. (English) - Adding Achievements and Leaderboards
  3. (eng) - Cloud Save
  4. (eng) - Also about cloud saving, I highly recommend this video
  5. (rus) - Publish a game on Google Play
  6. (rus) - Embedding Google Services in the game
  7. And a link to the documentation

And that’s all, thank you all!