Animator.SetAvatarDataSet performance spike when activating GameObject

I have a gameObject that’s activated via Timeline. The same gameObject is animated via Timeline as well. When the gameObject gets activated, it has a significant cost caused by Animator.SetAvatarDataSet:


(The profiler data was collected from a Windows 64 Standalone build on an AMD Ryzen 9 3900X)

However, the Timeline Animation Track has “Apply Avatar Mask” disabled:

The animation was recorded directly inside Unity via Timeline and the Animation window. The Animator that is causing the performance spike is the one controlled by Timeline.

How can I get rid of the Avatar cost, since the animation is not using an Avatar? :thinking:

As long as the Animator is used, the SetupAvatarDataset will be executed regardless. However, if the Avatar within your Animator is None, it will only generate an empty data structure (which costs little)