UAnimInstance::GetTimeToClosestMarker
#include "Animation/AnimInstance.h"
Access: public
Specifiers: UFUNCTIONBlueprintCallable
Description
Finds the nearest sync marker with the given name in the specified sync group and writes the time remaining until it is reached into OutMarkerTime. Returns false if the sync group or marker cannot be found.
Caveats & Gotchas
- • Marked BlueprintThreadSafe — safe to call from the animation worker thread, but the returned value reflects the previous frame's sync group position.
- • If the marker appears more than once in the animation, this returns the time to the closest upcoming occurrence. Looping animations may report a time close to 0 immediately after the marker is passed.
Signature
UFUNCTION(BlueprintCallable, Category="Animation", meta=(BlueprintThreadSafe))
ENGINE_API bool GetTimeToClosestMarker(FName SyncGroup, FName MarkerName, float& OutMarkerTime) const; Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| SyncGroup | FName | Name of the sync group to query. | — |
| MarkerName | FName | Name of the sync marker to find. | — |
| OutMarkerTime | float& | Receives the time in seconds until the closest marker of this name. | — |
Return Type
bool Example
Gate a transition on proximity to a sync marker C++
float TimeToFootDown = 0.f;
bool bFound = GetTimeToClosestMarker(FName("DefaultGroup"), FName("LeftFootDown"), TimeToFootDown);
if (bFound && TimeToFootDown < 0.1f)
{
bReadyToTransitionToStop = true;
} See Also
Tags
Version History
Introduced in: 4.12
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?