PhysicalAnimation Crash when EditableComponentSpaceTransforms gets Erroneously Emptied from a Parallel Thread

Hello - I just wanted to confirm that I believe (after much investigation!) that your change is safe, and in fact is probably the best/simplest way of solving the problem. I’ve just submitted changes that do essentially the same.

In case you’re interested, the underlying problem was this:

  • The Skeletal Mesh Component has a primary tick that runs the updates the animation graph.
  • This is assigned to the PrePhysics tick group (normally) BUT there is an optimisation where, if there is no physics on the character, it is allowed to run PostPhysics. So when the physics blend is zero, its tick function sets the EndTickGroup to PostPhysics
  • The PAC tick group is PrePhysics, but it has a prerequesite of the SKM tick. That means the PAC tick “inherits” this possibility to run PostPhysics , but of course only when the physics blend is zero (so it shouldn’t matter, right?)
  • However, the Blueprint graph runs after the components, in the PrePhysics tick group. When this sets physics blend = 1, it adds a new SKM secondary tick function to run during EndPhysics, that will process post-physics animation and write it back to the skeletal mesh.
  • So sometimes (depending on timing etc - happens about 1% of the time in my repros!) during the EndPhysics group:
    • The SKM secondary tick function runs. This initiates a parallel task to process the animation, and as part of this, the GetEditableComponentSpaceTransforms() array is transferred from the SKM to the animation context. This tick function then finishes (it will wait for the parallel animation processing to complete)
    • Now the PAC tick gets processed - and now in UpdateTargetActors it finds an empty array (as you spotted!)

The underlying problem is that tick functions are being registered/changed during the tick processing itself. It’s hard to deal with that, so the early out is the simplest and safest option.

The early-out is needed, but another solution is to set the cvar “tick.AnimationDelaysEndGroup=0”. This disables the optimisation that allows the SKM primary tick to run after PrePhysics.

Thanks for finding and reporting this problem!