[Huawei Developers] Mayism:
HUAWEI Game Service provides various capabilities, including automatic game update check, player information obtaining, floating window, game addiction prevention, game achievements, and leaderboards. Unity provides the HMS Core App Services SDK and demo for global developers to quickly integrate these capabilities and release their games on Huawei devices.

Let’s try this SDK.

Objective: Run the game demo provided by Unity to debug basic functional APIs, including init and APIs for HUAWEI ID sign-in.

Documentation

https://docs.unity.cn/cn/Packages-cn/com.unity.hms@1.2/manual/appgallery.html

Demo Download Path

https://github.com/Unity-Technologies/HMSSDKSample

The demo to be run is as follows.

Preparations

Step 1: Register as a Huawei developer, create a joint operations game, and add it to a project.

For details about the operations, please refer to the official documentation: https://developer.huawei.com/consum...connect-Guides/appgallerykit-preparation-game.

The following figure shows an example.

Step 2: Download the agconnect-services.json file in AppGallery Connect.

1. Go to the Project settings page of the project to which your game belongs. The following message is displayed. In this example, Manually enter the package name is selected.

2. Download the agconnect-services.json file.

Step 3: Replace the JSON file in the demo provided by Unity.

Replace the downloaded JSON file with the following file.

Step 4: Configure related files in the Assets/Plugins/Android directory.

For details about the operations, please refer to the Unity documentation:

https://docs.unity.cn/cn/Packages-c...configuration-files-into-assetspluginsandroid

Opening the Demo in UnityEditor

If you have not installed UnityEditor, you can install its latest version and Unity Hub by performing the operations in the following post. If you have installed UnityEditor, follow the operations below.

https://forums.developer.huawei.com/forumPortal/en/topic/0204435788744370088?fid=0101187876626530001

Step 1: Add a Unity project in Unity Hub.

The following figure shows how your project is displayed.

Note that you need to choose the correct Unity version when opening the project.

Step 2: Double-click the project and go to UnityEditor.

Ignore this message and click Continue.

Again, click Continue and wait for the project import to complete.

The demo page is as follows.

Completing the Build Settings for the Android Game

Step 1: Choose File > Build Settings….

Step 2: Click Player Settings… and the Project Settings tab page is displayed.

Note: If you have not installed the Android module, install it in UnityEditor as prompted. Restart UnityEditor to make the module take effect.

Step 3: Replace the game information, including Package Name and Version, with your actual game information configured in HUAWEI AppGallery Connect.

Step 4: Generate a signature file for your game.

Note: If a message is displayed, indicating that the JDK directory is not set or invalid, choose Edit > Preference > External Tools and change the default JDK directory. The system will automatically obtain the directory. If the directory cannot be found, you need to reinstall and restart UnityEditor. For details, please watch this video: JDK not found Unity | java development kit is not set or invalid unity.

In this example, the generated signature file is placed here.