Recently, I found that Unity has released a demo of the Huawei Game Service SDK version 5.0.4.302. To test the new capabilities provided by this version, I write a post to sync with you.

Demo Download Address:

https://github.com/Unity-Tech…

Change description:

Unity has previously released a plug-in that supports Huawei’s Game Service SDK4.0.1.300 version. This is a direct update to support Game Service SDK5.0.4.302 version

The changes to Unity are as follows:

Added getGamePlayer and getGamePlayer (bool isRequirePlayerID) interfaces to get the unique identity of the game player.

New SetGameTrialProcess, anti – addiction trial ability interface monitoring.

Added AccountAuthParamsPer, which allows developers to get more information about their Huawei account, such as OpenID, UnionID, email, etc.

Player objects have been added to OpenID, UnionID, AccessToken and OpenidSign fields.

Added AppPlayerInfo interface to save current player information.

For a more detailed description of the above changes, please refer to Huawei’s Game Services SDK version update:

https://developer.huawei.com/…

If you don’t have the ability to package and run the demo, please refer to this post:

Hand in hand teaches you to quickly run the Huawei game demo provided by Unity

AccountAuthParamsPer Looking at the C# source code, we can see that Unity currently supports request authorization by setting it as follows:

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

Authorization is requested here: Authorization of AuthorizationCode, Accesstoken, IDToken, UID, ID, Email and so on.

This is basically the same as the description in the documents of Huawei. Of course, we can set it by ourselves according to our business needs:

https://developer.huawei.com/…

Action: Click the Login> Login button

Phenomenon:

Check “Email” and click “Agree to Authorize”. A welcome box will appear on the interface. Relevant information can be obtained as follows:

It can be found that openID, unionID, AccessToken, AuthorizationCode and IdToken can all be obtained.

But I didn’t get email, and here I checked email on the authorization page, so why didn’t I get it? Later, I contacted Huawei technical support and found that I did not fill in my email address when I logged in. Naturally, I could not get it. You can check it under the email address of Huawei Mobile Phone Settings Huawei Account Center Account and Account Security, and there is no binding here.

If you actually bind an email, you can get it. After binding, the adjustment is as follows:

It is normal that the UID cannot be obtained. This has been verified with Huawei’s technical support, and the UID is not open to the public at present.

As you can see here, the latest version of the Unity plugin already supports multiple Huawei account information, and if the game wants to use Huawei account information such as UnionID or OpenID as the unique identity of the player, it is also possible.

GetGamePlayer interface is mapped to Huawei Game Service SDK5.0.4.302 version of GetGamePlayer interface, according to Huawei official website description, The only Player objects retrieved by this interface have values are DisplayName, OpenID, UnionID and AccessToken. I tested myself here.

Action: Click the Player> GetGamePlayer button

Phenomenon:

As you can see, this is consistent with the documentation description requirements on the Huawei side, and the only information returned is: DisplayName, OpenID, UnionID, AccessToken has values.

GetGamePlayer(bool isRequirePlayerID) This interface maps to the Huawei Game Service SDK5.0.4.302 version of getGamePlayer(Boolean isRequirePlayerID) interface, Support for retrieving both playerID and openID

Action: click on Player> GetGamePlayer (isRequirePlayerID)

Phenomenon:

This is also consistent with Huawei’s side requirements.

GetGamePlayer and getGamePlayer (bool isRequirePlayerID) interfaces For detailed instructions on how to use these two interfaces, I refer to Huawei’s documentation here, which you can also refer to.

https://developer.huawei.com/…

The SetGameTrialProcess interface is introduced on the official website of Huawei. To release games in mainland China, access is required to meet the requirements of game addiction prevention in mainland China. Since all the projects in my side are released overseas, it is not necessary for the time being.

AppplayerInfo needs to be used when saving saveplayerInfo interface for players. Here, our project is managed and saved our player information by ourselves, without using this interface of Huawei, so we don’t do tests either.

The most important changes from the previous version of the Game Service SDK4.0.1.300 are:

  1. Support us to set the scope of authorization of Huawei account information by ourselves, such as access to OpenID, UnionID, email and other information.
  2. Starting from version 5.0.4.302, Huawei Game Service SDKsupports games that used to get PlayerID as the unique identity of the player through GetCurrentPlayer interface, replacing the PlayerID with OpenID or UnionID. Hence the new GetGamePlayer interface, which Unity currently supports.
  3. Support for the SetGameTrialProcess, the ability to try out games in mainland China.

The original link: https://developer.huawei.com/… Author: Mayism