Existing Unity to WeChat mini-game

The content about the development of WeChat mini-games is detailed in "Unity WebGL WeChat Mini-Game Adaptation Scheme". Most of the more in-depth details will be ignored here, and you can find the answer by yourself in the address below.

The purpose of this article is to take everyone to quickly convert their existing games into WeChat mini-games.

"Unity WebGL WeChat mini-game adaptation program" address:
https://github.com/wechat-miniprogram/minigame-unity-webgl-transform

1. Preparation work:

1. Select the specified version of Unity

It is best to choose the version or there will be some strange problems

engine version Compress texture/audio Compile volume verified iteration other
2018 DXT only. ETC2IASTC is not supported 100% 2018.4.25-2018.4.34 Does not support setting dpr resolution
2019 DXT only, does not support ETC21ASTC 100% 2019.4.28-2019.4.35
2019 InstantGame Full support for DXT/ETC21ASTC 100% 2019.4.29
2020 DXT/ETC2. Does not support ASTC 100% 2020.3.1-2020.3.36
2021 Full support for DXT/ETC2IASTC 80% 2021.2.5-2021.2.18
2021 InstantGame Full support for DXT/ETC2/ASTC 80% 2021.2.5 Enhanced UnityProfiler

2. Install Node

Official download address: https://nodejs.org/zh-cn/download/
insert image description here

3. Download the mini game plug-in

Import the unitypackage package
https://res.wx.qq.com/wechatgame/product/wasm_plugin/minigame.202302151921.unitypackage

4. Log in to the WeChat public platform and register the mini program

Address of public platform: https://mp.weixin.qq.com/
Search WeChat public platform to register an account, and register a small program (need to use an email address that has not been bound to other functions of WeChat)insert image description here

5. Write game data and categories

insert image description here
Fill in the content in "Mini Program Information" and "Mini Program Category"

6. Get the AppID, which is the applet ID

In "Home" > "Mini Program Information" > "Basic Settings" > "Account Information", remember that it will be used later.
insert image description here

7. Select here, Capability Map>Production Efficiency Improvement Package>Enable High Performance Mode and Fast Adaptation

insert image description hereinsert image description here

8. Download and install "WeChat Developer Tools"

Address: https://developers.weixin.qq.com/miniprogram/dev/devtools/download.html
insert image description here

9. Register legal address

Set the security domain name (Development>Development Management>Development Settings>Server Domain Name)
and write all the addresses that need to be requested here, and the address to continue resource downloading, otherwise it will not be accessible. separated by;
insert image description here

2. Modification of the Unity project itself

The solution used here is not to load the AA package in advance, and you can skip this paragraph if you use other solutions.
Because mini-games have strict requirements on the package size, this step is mainly to change the resources into AA packages for loading, and then subpackage the content of the package body to the server to load in batches. If you don’t need subcontracting, you can choose it directly during packaging, which will be mentioned later.

10. Import Addressables in Unity

insert image description here
Change the synchronous loading or AB package loading in the original project to AA package asynchronous loading:
for example, modify:
insert image description here
to
insert image description here
load method:
insert image description here
to
insert image description here

11. All the package body paths can be selected by default:

insert image description here
Remember to build

Pay attention to the management of resource loading and unloading, which will not be described here.

3. Export project

12. Export the game package

After importing the WeChat package earlier, the "Menu Mini Game" will appear in the "Menu Bar". Select to convert the mini game.
insert image description here
If you are prompted to update, you must update it first.
insert image description here

13. View the export location

insert image description here

14. Upload resources

Put the contents of the webgl folder into the address of the previous step "2. External resource loading address"
insert image description here

15. Use WeChat developer tools to open

Click the plus sign to select the minigame selection option
insert image description here
in the project to open the project 4. Upload and publish
insert image description here

insert image description here

insert image description here

16. Upload game

When the game development and testing is completed, click here to upload
insert image description here

17. Test experience

In the WeChat test platform, select "Management" and "Version Management" to see the trial version just uploaded in the development version, and you can scan the code to experience it.
Due to the fact that it is not online, it may be given to designated members to experience.

18. Add testers

Select "Management", "Member Management" and "Project Members" to add WeChat successfully, and you can scan the code for testing
insert image description here

19. Submit for review

After the test is completed, click Submit for review in "Version Management" and "Development Version". For
the first submission, you need to fill in the relevant resources of the application.
After the review is passed, you can click Publish
insert image description here
. This is done. The above examples are for your reference. For more details, please refer to the following documents. If there is anything missing, please leave me a message or private message, thank you.

Teaching video address (outsourcing link is not used, no subcontracting):
https://www.bilibili.com/video/BV1LG41177yf/?spm_id_from=333.1007.top_right_bar_window_history.content.click
More comprehensive explanation:
https://blog. csdn.net/zhangay1998/article/details/128774741
Performance optimization overview:
https://github.com/wechat-miniprogram/minigame-unity-webgl-transform/blob/main/Design/PerfOptimization.md
Performance standard:
https:/ /github.com/wechat-miniprogram/minigame-unity-webgl-transform/blob/main/Design/PerfMeasure.md
Code Subcontract:
https://github.com/wechat-miniprogram/minigame-unity-webgl-transform/ blob/main/Design/WasmSplit.md

Guess you like

Origin blog.csdn.net/ww1351646544/article/details/129157463
Recommended