Guides & References

Get comprehensive guides and references for using the game service in the HMS Unity plugin by EvilMindDevs.

There is a custom editor in Huawei > Kit Settings > Game Service tab.

Check the "Initialize on Start" checkbox to initialize the Game Service Kit on Start or call HMSGameManager.Instance.Init() in your custom logic.

   HMSGameManager.Instance.Init();

You can use the "Create Constant Classes" button to create a class called HMSLeaderboardConstants or HMSAchievementConstants which will contain all achievements and leaderboards as constants and you can call it from your code. Such as;

    HMSLeaderboardManager.Instance.SubmitScore(HMSLeaderboardConstants.topleaderboard,50);
    HMSAchievementsManager.Instance.RevealAchievement(HMSAchievementConstants.firstshot);

You can call native calls to list achievements or leaderboards.

  HMSAchievementsManager.Instance.ShowAchievements();
  HMSLeaderboardManager.Instance.ShowLeaderboards();

App Update in Game Service

There is a method in Game Service called CheckAppUpdate that will trigger the update mechanism of HMS to detect if there is a newer version in AppGallery. It triggers OnAppUpdateInfo inside HMSGameManager that is returning status,rtnCode,rtnMessage,isExit,buttonStatus. This callback gets called after CheckAppUpdate is done. If you want to receive this callback, please subscribe to it before calling CheckAppUpdate.

It requires two booleans; showAppUpdate: Making this true will prompt a native UI that will show the user there is a newer version if there is an update. forceAppUpdate: Making this true will remove the cancel button from the UI and force the user to update.

    HMSGameManager.Instance.OnAppUpdateInfo = OnAppUpdateInfo;
    HMSGameManager.Instance.CheckAppUpdate(showAppUpdate,forceAppUpdate);

Last updated