Unity Loading Module In-depth Analysis of Animation Resources


Diamond Patron
Unity Loading Module In-depth Analysis of Animation Resources

In the previous technology push, we have analyzed the texture, mesh, shader and other resources in the loading module for everyone. Today we continue the series by sharing with everyone the things need to pay attention to when loading animation clips.

Please continue to pay attention to this series. After collecting in-depth analysis of all resource types, you can summon the great god!

Resource Loading Performance Test Code

Like the test code mentioned in the previous articles, we also use this test code for the loading performance analysis of AnimationClip resources. At the same time, we made the AnimationClip file into an AssetBundle file of a certain size, and loaded them on different devices through the following code one by one, in order to obtain the corresponding resource loading performance comparison.

Test environment

Engine Version: Unity 5.4 version

Test Equipment: Three mobile devices of different grades (Android: Redmi 2, Redmi Note2 and Samsung S6)

AnimationClip Resources

AnimationClip resource is one of the most frequently loaded resources when the project is running, and its loading efficiency is mainly determined by its own loading capacity, and the main factor that determines the loading capacity of AnimationClip resource is its compression format. Currently, the Unity engine provides three compression formats for the imported AnimationClip, Off, Keyframe Reduction and Optimal. Among them, Off means that no compression processing is used; Keyframe Reduction means that keyframes are used for processing, and Optimal means that the Unity engine will automatically select an optimal compression method according to the characteristics of the animation curve, may be keyframe compression, it could be Dense compression.

Note: For the explanation of the specific compression method in the AnimaitonClip curve, please check the Unity official manual document:

Test: Test the loading efficiency of AnimationClip resources in different compression formats

We have produced three sets of test cases, the number of AnimationClip resources are 10, 30 and 50 respectively. At the same time, each group of AnimationClip is divided into three groups based on its compression format: None Compression, Keyframe Reduction and Optimal.

We load these AnimationClip resources on three different grades of models. To reduce contingency, we have repeated the load operation ten times on each device and take the average value as the final performance cost. The specific test results are shown in the table below.

Group 1 test

After 10 “None Compression” resources, 10 “Keyframe Reduction” resources and 10 “Optimal” resources are packaged into AssetBundle files, their file sizes are: 409KB, 172KB, and 92KB respectively.

Group 2 test

After 30 “None Compression” resources, 30 “Keyframe Reduction” resources and 30 “Optimal” resources are packaged into AssetBundle files, the file sizes are 1.42MB, 514KB and 312KB respectively.

Group 3 test

After 50 “None Compression” resources, 50 “Keyframe Reduction” resources and 50 “Optimal” resources are packaged into AssetBundle files, the file sizes are: 2.46MB, 858KB and 525KB respectively.

Through the above test, we can draw the following conclusions:

1. Optimal compression method can indeed improve the loading efficiency of resources, whether it is on high-end, mid-range or low-end devices;
2. The better the performance of the hardware device, the higher its loading efficiency. However, with the improvement of equipment, the improvement of the loading efficiency of Keyframe Reduction and Optimal is not very obvious;
3. The Optimal compression method may lower the visual quality of the animation. Therefore, whether the Optimal compression mode is finally selected depends on the acceptance of the final visual effect.​

Optimization suggestion

For the optimization of resources, our suggestion is that prevention is greater than disaster relief! The specific feasible methods are as follows:

1. Our project team have wrotea resource detection tool (or find the relevant asset detection toolsin the Unity Asset Store) to check the data information of the AnimationClip resource, and check whether its compression format and file size are reasonable;
2. If your project is using the UWA performance evaluation service, you can view the memory usage and animation duration of AnimationClip resources in the “Specific Resource Usage Interface” to locate whether there are non-compliant AnimationClip resources;
3. If your project is using the UWA resource detection service, you can view the AnimationClip resource in the “Resource Usage” interface, focusing on its “Dense curve number” and “Stream curve number”. Generally speaking, only the AnimationClip resource with Optimal compression mode enabled will have the “Dense curve number”.
The above is the performance test of the AnimationClip resource when it is loaded. Regarding the performance of loading modules, we will continue to introduce a series of technical articles such as audio resource loading performance analysis, resource unloading performance analysis, resource instantiation performance analysis, and performance analysis of different loading methods. The common problems of the projects tested by UWA are summarized, in order to let everyone have a deeper understanding of the loading efficiency of the project and improve the ability to control the loading module.

More details: https://blog.en.uwa4d.com/2021/11/30/unity-loading-module-in-depth-analysis-of-animation-resources/
As we all know, our life has a limit but knowledge has none. These problems are only the tip of the iceberg and there are more technical problems during our program development which deserve to discuss. Welcome to join UWA Q&A community, let‘s explore and share knowledge together!

UWA is a professional game testing, VR and AR applications development company. We provide various products optimization for developers that using the Unity and Unreal Engine, which include the online service and local tools for performance optimization. We are providing support for Tencent game, NetEase game and some world-wide companies.

UWA website: en.uwa4d.com
UWA Blog: blog.en.uwa4d.com
UWA Q&A community:answer.uwa4d.com
LinkedIn: https://www.linkedin.com/company/uwahub
Facebookpage: https://www.facebook.com/uwa4d