Keyword
Memory leakage
Resource production
Memory Leakage
Q1: Our test found that when the Animator Controller mounts a lot of actions, even if it is switched to another Animator Controller with few actions, the action information of the task will not be released. We packed the hero into an AssetBundle, and then loaded and replaced the customized Runtime Animator Controller. The Runtime Animator Controller that comes with the hero has mounted all actions. After we tried to replace the Runtime Animator Controller, we destroyed the previous Runtime Animator Controller, and it seemed that the memory was not released.
Destroying the Animator Controller will not release the referenced AnimationClip resources, so it is normal that the memory does not drop significantly. It is recommended to do an experiment in the following way:1) After destroying the Animator Controller, use the Unity Profiler to immediately take a real machine Take Sample to check whether the Ref count of the Animation Clip is 0;2) If it is not, you need to further check the index source of these resources; if it is 0, you can remove it from the memory > by UnloadUnusedAssets or UnloadAsset.
Resource production
Q1: Does Optimize Game Objects have any effect on the old version of the Animation system?
No effect. The Optimize Game Objects function is the function introduced in Unity 4.3 and only works on the Mecanim animation system. If possible, it is recommended that the R&D team use Mecanim as a solution for the project animation system as much as possible.
Q2: In the UWA performance report, you suggest that we select Optimize GameObject to improve the running performance of the Mecanim animation module, but this function will conceal the character skeleton, so this point on the skeleton cannot be queried if it is mounted. Is there any way to solve this problem?
Q3: When is SkinnedMeshRenderer.BakeMesh normally called? Is it called after Instantiate?
The function of SkinnedMeshRenderer.BakeMesh is: Bake an action at a certain time point of a skinned animation into a Mesh without skin, so that an animation can be converted into a set of Mesh sequence frames through a custom sampling interval. Then when playing the animation, you only need to select the nearest sampling point (ie a Mesh) for assignment, which saves the time of skeleton update and skin calculation.The advantage of this method is that it uses memory for calculation time. When a large number of the same model with animation appears in the scene, the effect will be very obvious. The disadvantage of this method is that the memory usage is greatly restricted by the number of model vertex, total animation duration and sampling interval. Therefore, this method is only suitable for models with a small number of vertex and a short total animation duration. At the same time, Bake takes a long time, so it needs to be completed when loading the scene.The classic scene is the soldier in the MOBA game.
Q4: In the report given by UWA, we found that the Animator is too high, where the UI and the characters account for half. We have always chosen CullUpdateTransforms before, by reading the official Unity documentation, we found that CullCompletely is more in line with our current situation. I would like to ask if we choose CullCompletely, what are the hidden dangers?
When using CullCompletely, you need to pay attention to turn on RootMotion, for example, if a character has a patrol animation that is made by RootMotion, he animation will stop after the character walks out of the screen, that is, it will not walk back to the screen.
Q5: We made 40 skeletons during the art production, but only 30 of them were used in the action. Is this a significant increase in skin calculation compared to 30 skeletons for 30 skeletons? (Animation has been compressed)
Theoretically, there is an increase. The skeletal calculations are all multiplied by the Matrix of each skeletal stage, so theoretically there will be cost. It is recommended to use the Optimize GameObejct option, which can reduce some unnecessary CPU cost.
-----------------------------------------
Due to the content space, image limitation, for the full content with data and graphics, please feel free to read more here: https://blog.en.uwa4d.com/2021/12/02/regarding-unity-animation-system-optimization-you-probably-encounter-these-problems/
Please feel free to read more related topics on the UWA official blog page at https://blog.en.uwa4d.com. Over 9000 video games tested and optimized by UWA Game Optimization Toolkit, if you want to have a 15-day free trial, you can visit the UWA official website and register an account at: https://en.uwa4d.com/feature/got
You may also like:
In the six months when the game version number was suspended and the pandemic repeated, how does UWA practice the game industrialization?
With 35 lectures in 2 days, focusing on industrialization problems, what substantial knowledge of game R&D did UWA DAY 2021 bring?
UWA DAY 2022 Conference Topic Submission — Practicing the Industrialization of Game R&D
https://blog.en.uwa4d.com/2022/03/14/uwa-day-2022-conference-topic-submission/
A Happy Knowledge Sharer:
To be honest, my current and previous video game studios and video game developer friends who develope video games all using UWA game performance optimization toolkit, It saves us lot of time, human resource and cost. I know UWA provides a variety of optimization products for developers who use Unity Engine and Unreal Engine, such as: Game Performance Monitor, Static Testing, Game Optimization Toolkit Online, etc., helping developers efficiently solve development problems, locate performance bottlenecks and find solutions.
By the way, if you want to test and optimize your game, you can tell them that i recommended you, they will free test your game and free provide you game optimization solutions. This is special ~~~