0/ 1204/ /4

1) Strategic Choice of Resource Management during the Development Period

2) IL2CPP Encryption: Decryption Problem of Global-metadata.dat in iOS System

3) How to Realize Programmable 3D Actions

4) Width and Height of Screen in Unity Editor


Q1: AssetBundle is required for packaging, but using AssetBundle is not very friendly in development. The following two types of loading will have their own problems:

Resources: Need to be placed in the Resources folder, which is not easy to package.

AssetDatabase: There is no asynchronous loading method, and there is no way to simulate some situations that require asynchronous loading during development.

The Resources method is currently used in our project, and the packager packaged two projects. During the process, Resources in the APK one have been castrated and a separate version management update command was written, but it is still very troublesome. As I know, AssetDatabase is used by most companies. Is there any way to simulate asynchronous loading?

In addition, neither of the above two methods can simulate the real uninstall situation. When the team members operate unreasonably, there will be memory leakage or reference missing cases after opening the AssetBundle. Could anyone share some resource management solutions used by your company during development?

A1: With AssetDatabase, you can add some randomly delayed simulators in asynchronous programming, with the resource loading interface encapsulated. Then, you can decide whether to use AssetDatabase or AssetBundle according to the configuration.

Our packager will automatically submit the packaged AssetBundle to SVN, which can be updated at any time. It is more convenient to test the AssetBundle in the editor.

In addition: you can also try the new Addressable.


A2: I’ve heard that a project team’s approach is to use Resources to load during the daily development process; then a new project will be automatically generated based on certain rules under Resources directory while packaging an AssetBundle or official APK, so that there is no need to maintain two projects.


A3: Previously, we use a coroutine to stimulate the asynchronous under AssetDatabase, namely LoadFromFileAsync. Another method I tried later is to use a separate art project to process the AssetBundle, and the program project is not responsible for any resources, and only uses the AssetBundle packaged and generated by the art project. At first sounds, the process is complicated, and a little change requires the operation of 2 Unity projects. But it also has many advantages.

The loading part of AssetDatabase can be reserved for debugging in the code. Of course, using AssetBundle in daily development can expose the Bug of AssetBundle on the Editor side most of the time, instead of having the problem when it is on the real device.


A4: We used Resources to load before, but the resources were placed in the Editor/Resources directory to avoid being packed.

Then we will switch the Flag when publishing, and read the resources in the Editor/Resources directory to pack the AssetBundle. But now it’s all over to Addressables to manage.


Q1: To increase the difficulty level in decoding, the global-metadata.dat file needs to be encrypted. The way to achieve this is: 

  1. Encryption is performed on global-metadata.dat by byte after exporting Android and Xcode projects.
  2. Modify:

Android: \Editor\Data\il2cpp\libil2cpp\vm\MetadataLoader.cpp


The LoadMetadataFile function in the file decrypts the content read from the file byte by byte.

This leads to a situation that there is no problem on Android, and the game can be encrypted and run normally; but on the Mac, it seems that the decryption function does not take effect, causing the launch of the game to crash.

My question is that does the reading of global-metadata.dat load through the LoadMetadataFile function On Mac? I saw that there is also a PlaybackEngines folder in the Unity installation directory on Mac, which also contains IL2CPP related files, such as MetadataLoader.h, but this file is read-only and cannot be modified, and MetadataLoader.cpp is not found. Does decryption not work on Mac have something to do with this file?

A: On iOS, it is directly linked to the pre-compiled PlaybackEngines\iOSSupport\Trampoline\Libraries\libil2cpp.a.

You may need to remove .a from the project, and import the IL2CPP source code into the project.

Q2: Does the project refer to the Xcode project under the iOS Support/Tramponline folder? Should all the files in\Contents\il2cpp\libil2cpp be added to this project?

A: It is an exported project. As for which files, you may need to try by yourself. You can export a IL2CPP VS project on Windows to compare the files and compilation parameters.

Q3: We recently encountered this iOS encrypted Metadata problem. Is there a solution for this? Looking at this post:, it seems that Unity source code is needed?

A: Dragging the IL2CPP code directly to the XCode project may be working.


Q: Our requirement is to build a program to make flexible clapping action, as shown below:

There is a large model in the middle, with the left and right hands making the clapping action. The blue dots can be used as the clapping points, which means that the program should control where to shoot. The current solution is:

  1. Make a lot of clapping animations, and then use two-dimensional blending in Blend Tree, but that is not accurate enough.
  2. Use Final IK to control the movement of both palms, but the movement is unnatural. We also want to minimize the K-action work to minimize the cost. Is there any other solution available?

A1: This kind of demand is basically fulfilled by IK. Final IK is the most mature IK solution in Unity engine currently seen. If it still doesn’t work, you may need to consider developing one yourself.


A2: We used the Blend Tree of 2D Freeform Directional before to fuse the movements of the front, back, left and right. The fusion effect is ideal. In principle, you do four clapping actions on the most left, right, top, and bottom points, and then use two parameters to control the fusions of left to right and up to down respectively, and the accuracy should be acceptable. Since I don’t have the resources to test and I’m not sure about the degree of accuracy you require, so I suggest you try a demo.


Q: Tested in Unity 2018.4.23, after a new resolution of 9:16 is added, you will obtain a Width x Height ratio as 515×916. If you change the size of the Game window, this value will also change. What is the specific rule behind this?

It is found that it should be multiplied by the Scale value at the corresponding resolution. For example, at a resolution of 720×1280, the Scale value of the Game window is 0.741, and the resolution after cutting to 9:16 is exactly 533×948 (720×0.741: 1280×0.741). Is there an API that can get this value?

Because there are some UI operations, for example, a picture will be set to the same size as the screen, but the UI resolution under the Editor is 720×1280, so it will be different from the expected value. If the resolution is set to 720×1280 (also 9:16), then the obtained value is correct.

I mainly want to know the rules, and then convert it to 720×1280 based on 515×916.

A: In the editor, if the Game window adopts the Aspect Ratio mode, what Screen gets is the actual size of the Game window. If the Game window uses a fixed resolution (Fixed Resolution). What Screen gets is the set window size.

That’s all for today’s sharing. Of course, life may have its limit but knowledge knows no bounds. In the long development cycle, these problems you see maybe just the tip of the iceberg. We have already prepared many technical topics on the UWA blog, waiting for you to explore and share them together. You are welcome to join in, who loves progress. Perhaps your method can solve the urgent needs of others, and the “stone” of other mountains can also attack your “jade”.


UWA Website:

UWA Blogs:




Related Topics

Post a Reply

Your email address will not be published.