UAnimInstance::GetInstanceTransitionCrossfadeDuration
#include "Animation/AnimInstance.h"
Access: public
Specifiers: UFUNCTION
Description
Returns the configured crossfade blend duration in seconds for a specific state machine transition. The value reflects the duration set in the transition's properties in the Animation Blueprint editor.
Caveats & Gotchas
- • This returns the static authored duration, not the remaining or elapsed crossfade time. To check how far through a crossfade you are, use GetInstanceTransitionTimeElapsedFraction instead.
- • TransitionIndex is compiler-assigned and fragile across recompiles. This function is primarily intended for internally generated AnimBP code; manually managing transition indices in C++ is brittle.
Signature
UFUNCTION(BlueprintPure, Category="Animation", meta=(BlueprintInternalUseOnly = "true"))
float GetInstanceTransitionCrossfadeDuration(int32 MachineIndex, int32 TransitionIndex) const; Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| MachineIndex | int32 | Index of the state machine containing the transition. | — |
| TransitionIndex | int32 | Index of the transition within the state machine. | — |
Return Type
float Example
Log the crossfade duration for a specific transition C++
int32 MachineIdx = GetStateMachineIndex(FName("LocomotionSM"));
int32 TransitionIdx = 0; // From AnimBP compiled constant
float Duration = GetInstanceTransitionCrossfadeDuration(MachineIdx, TransitionIdx);
UE_LOG(LogAnim, Log, TEXT("Crossfade duration: %.3fs"), Duration); See Also
Tags
Version History
Introduced in: 4.8
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?