RealDocs

UAnimInstance::IsRunningParallelEvaluation

function Engine Since 4.16
#include "Animation/AnimInstance.h"
Access: public Specifiers: ENGINE_API

Description

Returns true if this anim instance is currently being evaluated on a worker thread rather than the game thread. Use this to guard code paths that must behave differently depending on which thread is executing.

Caveats & Gotchas

  • This function is itself thread-safe and can be called from any thread. However, branching on its result to do game-thread-only work (like spawning actors or modifying UProperties) defeats the purpose of parallel evaluation and should be avoided — move such work to NativeUpdateAnimation or a game-thread callback instead.
  • The return value is only meaningful during animation evaluation. Outside of the evaluation window (e.g., in Tick or BeginPlay), it always returns false regardless of configuration.

Signature

ENGINE_API bool IsRunningParallelEvaluation() const;

Return Type

bool

Example

Guard thread-sensitive code in a custom anim node C++
void UMyAnimInstance::UpdateCustomState()
{
	if (IsRunningParallelEvaluation())
	{
		// On worker thread — only access thread-safe data
		CachedDirection = ThreadSafeDirection.load();
	}
	else
	{
		// On game thread — safe to access UObjects
		if (AActor* Owner = GetOwningActor())
		{
			CachedDirection = Owner->GetActorForwardVector();
		}
	}
}

Version History

Introduced in: 4.16

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.