UAnimInstance::CanRunParallelWork
#include "Animation/AnimInstance.h"
Access: public
Specifiers: ENGINE_API
Description
Returns whether this anim instance is eligible to run its animation evaluation on a worker thread in parallel with the game thread. The result depends on project settings, the skeletal mesh component's parallel evaluation flag, and whether the current graph nodes all support thread-safe evaluation.
Caveats & Gotchas
- • Returning true does not guarantee parallel execution will actually occur — the task graph scheduler makes the final decision based on available workers and current frame load. Use IsRunningParallelEvaluation to check if parallel evaluation is actually in progress.
- • Custom anim graph nodes that access game-thread-only data (UObjects not marked thread-safe, world queries, etc.) can silently cause race conditions if parallel evaluation is enabled. Ensure all custom nodes implement thread-safe access patterns or disable parallel evaluation for graphs that use them.
Signature
ENGINE_API bool CanRunParallelWork() const; Return Type
bool Example
Check parallel eligibility before scheduling work C++
void UMyGameMode::OptimizeAnimationSetup(USkeletalMeshComponent* MeshComp)
{
if (UAnimInstance* AnimInstance = MeshComp->GetAnimInstance())
{
if (AnimInstance->CanRunParallelWork())
{
UE_LOG(LogAnimation, Log, TEXT("%s can run parallel animation evaluation"),
*MeshComp->GetOwner()->GetName());
}
}
} Tags
Version History
Introduced in: 4.16
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?