UAnimInstance::GetCurveValueWithDefault
#include "Animation/AnimInstance.h"
Access: public
Specifiers: UFUNCTIONBlueprintPureBlueprintThreadSafe
Description
Reads the current value of a named animation curve, falling back to a caller-supplied default if the curve is not currently active. Returns true if the curve was found, false if the default was used.
Caveats & Gotchas
- • Returns false and uses the default value if the curve is inactive during this frame — this can happen legitimately when a state has no animation playing. Do not treat false as an error.
- • Marked BlueprintThreadSafe, so it is safe to call from the AnimGraph thread. However, the value reflects the previous frame's evaluation result when accessed from NativeUpdateAnimation on the game thread.
Signature
ENGINE_API bool GetCurveValueWithDefault(FName CurveName, float DefaultValue, float& OutValue); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| CurveName | FName | The name of the animation curve to read. | — |
| DefaultValue | float | Value to return in OutValue if the curve is not active. | — |
| OutValue | float& | Receives the current curve value or DefaultValue if not found. | — |
Return Type
bool Example
Reading a foot IK weight curve with a safe default C++
float IKWeight = 0.0f;
bool bFound = GetCurveValueWithDefault(FName("FootIK_Weight"), 0.0f, IKWeight);
// Use IKWeight regardless of bFound — it holds either the live or default value.
LeftFootIKAlpha = IKWeight; Tags
Version History
Introduced in: 4.21
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?