HMS Multi Kit Integration (Extended) in Unity Game Development
Huawei provides various services for developers to make ease of development and provides best user experience to end users. In this article, we will be integrating following kits:
Ads Kit
Game services
Analytics Kit
Location Kit
Push Kit
Introduction
Huawei provides various services for developers to make ease of development and provides best user experience to end users. In this article, we will be integrating following kits:
- Ads Kit
- Game services
- Analytics Kit
- Location Kit
- Push Kit
We will learn to integrate above HMS Kits in Unity game development using official plugin. And by integrating in single application gives experience the ease of development and give best user experience and showcases stability of the kits, and how we can use kits efficiently to make users experience the best of it.
Development Overview
You need to install Unity software and I assume that you have prior knowledge about the unity and C#.
Hardware Requirements
- A computer (desktop or laptop) running Windows 10.
- A Huawei phone (with the USB cable), which is used for debugging.
Software Requirements
- Java JDK installation package.
- Unity software installed.
- Visual Studio/Code installed.
- HMS Core (APK) 4.X or later.
Integration Preparations
1. Create a project in AppGallery Connect.
2. Create Unity project.
3. Adding Huawei HMS AGC Services to project.
4. Generate a signing certificate.
5. Generate a SHA-256 certificate fingerprint.
To generating SHA-256 certificate fingerprint use below command.
6. Configure the signing certificate fingerprint.
7. Download and save the configuration file.
Add the agconnect-services.json file following dir Assets > Plugins > Android
8. Add the following plugin and dependencies in LaucherTemplate
9. Add the following dependencies in MainTemplate.
10. Add the following dependencies in MainTemplate, repositories & class path in BaseProjectTemplate.
11. Add Achievement details in AGC > My apps
12. Add LeaderBoard details.
13. Add Events list.
14. Create Empty Game object rename to GameManager, UI canvas texts & write assign onclick events to respective text as shown below.
15. To build apk and run in device, choose File > Build Settings > Build for apk or Build and Run for run on connected device.
16. Result.
Tips and Tricks
- Add agconnect-services.json file without fail.
- Add SHA-256 fingerprint without fail.
- Add Achievements and LeaderBoard details before run.
- Make sure dependencies added in build files.
- Enable location and accept permission to read location.
Conclusion
We have learnt integration of HMS GameService Kit, Ads Kit, Location kit, Push Kit and Analytics kit in Unity. Error code while fetching Player extra information and Event Begin and end.
7006: The account has not been registered in Chinese mainland. In this case, perform bypass and no further action is required.
Thanks for reading, please do claps and give your valuable feedback/suggestion.
References