UAnimInstance::AddNativeTransitionBinding
#include "Animation/AnimInstance.h"
Access: public
Specifiers: ENGINE_API
Description
Binds a native C++ delegate to an animation state machine transition. When the engine evaluates whether to take the transition from PrevStateName to NextStateName, it calls the bound delegate instead of (or in addition to) the Blueprint transition rule.
Caveats & Gotchas
- • The state and machine names must match the names in the Animation Blueprint graph exactly (case-sensitive). A mismatch silently fails — the delegate is never called.
- • Call this during NativeInitializeAnimation, not every frame. Adding duplicate bindings for the same transition will stack them, not replace the previous one.
Signature
ENGINE_API void AddNativeTransitionBinding(const FName& MachineName, const FName& PrevStateName, const FName& NextStateName, const FCanTakeTransition& NativeTransitionDelegate, const FName& TransitionName = NAME_None) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| MachineName | const FName& | Name of the state machine to bind to. | — |
| PrevStateName | const FName& | Name of the source state for the transition. | — |
| NextStateName | const FName& | Name of the destination state for the transition. | — |
| NativeTransitionDelegate | const FCanTakeTransition& | Delegate that returns bool — true to allow the transition. | — |
| TransitionName | const FName& | Optional name to identify this binding for later queries. | NAME_None |
Return Type
void Example
Bind a native transition rule in C++ C++
void UMyAnimInstance::NativeInitializeAnimation()
{
Super::NativeInitializeAnimation();
FCanTakeTransition Delegate;
Delegate.BindUObject(this, &UMyAnimInstance::CanTransitionToJump);
AddNativeTransitionBinding(FName("Locomotion"), FName("Idle"), FName("Jump"), Delegate);
}
bool UMyAnimInstance::CanTransitionToJump()
{
return bIsJumping;
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?