UAnimInstance::Blueprint_GetMainAnimInstance
#include "Animation/AnimInstance.h"
Access: public
Specifiers: ENGINE_APIUFUNCTIONBlueprintCallable
Description
Returns the main animation instance hosted directly on the skeletal mesh component. From a linked animation instance, this provides access to variables and functions on the parent graph.
Caveats & Gotchas
- • Returns `this` when called on the main instance itself — always check whether the result is the same object before using it to navigate the instance hierarchy.
- • Only valid after InitializeAnimation completes. Calling it during construction or before the mesh component is fully set up returns null.
Signature
UFUNCTION(BlueprintCallable, Category = "Animation", meta = (DisplayName="Get Main Anim Instance", BlueprintThreadSafe))
ENGINE_API UAnimInstance* Blueprint_GetMainAnimInstance() const Return Type
UAnimInstance* Example
Access main instance variable from a linked anim instance C++
if (UMyMainAnimInstance* Main = Cast<UMyMainAnimInstance>(Blueprint_GetMainAnimInstance()))
{
bIsCrouching = Main->bIsCrouching;
} Tags
Version History
Introduced in: 4.24
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?