Unity packages WeChat games and configures the entire process of CDN

Last updated: 2023-08-04

Don’t just collect it, remember to like it, old man@_@

Insert image description here

1. WeChat cloud development configuration CDN

1.1 Packaging

Insert image description here

1.2 File upload

Insert image description here

1.3 Configuration path

Click on the file and we can see the path.
Insert image description here
Configure this location and save it. The debugging passes.
Insert image description here

2. Obtain a CDN server [Qiniu Cloud as an example]

We need to buy CDN products. The prices of different manufacturers are different. You can buy according to your own needs. There are basically discounts for new users. It is generally sufficient for testing or when the number of users is small.
[Note]
A very troublesome point here is that if you do not use WeChat cloud service, if you use other CDN services, you must use https .
Insert image description here

2.1 Package WeChat mini-games

Small game unity packaging tool [Official]
Unity CDN configuration official document

2.2. Upload files to CDN server

As shown in the picture, when we package it through the WeChat tool, there will be two folders, minigame and webgl. We need to upload the files in the red box to our CDN.
Insert image description here
If the path of the CDN we configure is http://www.mydomain.com/version02/
, then the resources on the CDN must be stored in the following way, and the system will directly obtain the corresponding files.
Insert image description here

2.3. Resource optimization

The txt files here can also be compressed once. 8MB txt can be compressed to 2MB.
Compression tool GZIP compression tool . If the link fails, go to Baidu to find the gzip compression tool.
Insert image description here
The suffix of the compressed txt is .gz. It can still be loaded using cdn.
Insert image description here

Guess you like

Origin blog.csdn.net/weixin_42581660/article/details/128638272