HUGE Lag spikes in editor when playing an animation. Over 400ms GC.Collect (profiler screen included)

I’m trying to make a simple 1D Blend Tree, playing the animation in a single Inspector window.

After Unity restart, the problem does not exist, but after 20-30seconds, the lag spikes start to appear and soon the Editor is unusable when playing the Animation. See attached screen.

Any ideas?

GC Collect is the garbage collector. Are you doing any linq or initialising and destructing of game objects/ classes?

If so I would suggest not and pooling your objects instead. Realistically you want to only to be destroying objects at opportunistic times i.e. when GC spikes aren’t going to cause performance issues.

I am having this same problem in Unity 2020.1.17f when any Generic or Humanoid animation, importer or transition is selected and displayed in the Inspector, no need for Blend Trees to be present, or for the Preview Drawer to be unfolded. I get the same ~400ms worth of GC Collection every 3-5 seconds even when the animation is not being played.