Integrating New Capabilities of Game Service SDK Using Unity​


Recently, I found that Unity had released a demo for Game Service SDK Let’s try this version.

I discovered that the last version of the Unity plugin for the Game Service SDK was, whereas the latest version is

This version contains the following changes:

You can view change history details about the Game Service SDK on the official website.

Testing the APIs

In this post, I just ran the Unity demo. If you’re not sure how to package and run a demo, check this post.


According to the C# source code, Unity supports request authorization in the following way:

AccountAuthParamsHelper authParamsHelper = new AccountAuthParamsHelper();      authParamsHelper.SetAuthorizationCode().SetAccessToken().SetIdToken().SetUid().SetId().SetEmail().CreateParams();

By using this code, you can request information including the authorization code, access token, ID token, UID, ID, and email address.

This part is also included in this document. You can complete configurations as required.

I tapped Login then login in the test app, which displayed the following page.

I selected Obtain your email address and tapped Authorise and log in. A welcome pop-up was displayed, containing the following information.

The OpenID, UnionID, access token, authorization code, and ID token could be found in the log information.

However, the email address I requested was not obtained. Why did this happen? I contacted Huawei technical support and found that no email address had been configured for the signed-in HUAWEI ID. So, I went to Settings > Account center > Account and security on my Huawei phone and discovered that there was indeed no email address.

After I configured an email address, the address could be obtained. The following figure shows the test result.

Huawei technical support also told me that UIDs currently cannot be obtained.

The latest plugin version allows you to obtain further information about a HUAWEI ID, including a player’s UnionID and OpenID.


This API maps the getGamePlayer API of Game Service SDK According to official documentation, only displayName, openId, unionId, accessToken in the Player object have values. This is how I tested it.

I tapped Player then getGamePlayer in the test app, which displayed the following page.

The result was identical to that described in Huawei’s official documentation.

GetGamePlayer(bool isRequirePlayerId)

This API maps the getGamePlayer(boolean isRequirePlayerId) API of Game Service SDK and allows you to obtain the player ID and OpenID at the same time.

I tapped Player then getGamePlayer(isRequirePlayerId) in the test app, which displayed the following page.

This was also consistent with Huawei’s description.

Usage Description of GetGamePlayer and GetGamePlayer(bool isRequirePlayerId)

For details about how to use the two APIs, please check this document.


Official documentation states that this API is required for games released in the Chinese mainland in order to prevent game addiction. I skipped this step as my app will be released outside the Chinese mainland. In order to test this API you must submit a request to Huawei.


This class is used when the savePlayerInfo API is called. I did not test this API as we saved our player information independently, meaning we did not use this API.


Compared with Game Service SDK, this version of the Unity plugin has the following major changes:



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store