UKismetSystemLibrary::K2_GetTimerElapsedTime
#include "Kismet/KismetSystemLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Returns how much time has elapsed in the current iteration of the timer bound to the given object/function pair.
Caveats & Gotchas
- • Returns 0.0 both when the timer genuinely just started and when no timer exists for that object/function — you can't tell the two cases apart from this value alone, check K2_TimerExists first if it matters.
- • For a looping timer this is the elapsed time since the current loop iteration began, not the total time since the timer was first set.
Signature
static ENGINE_API float K2_GetTimerElapsedTime(UObject* Object, FString FunctionName) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Object | UObject* | Object that implements the target function. Defaults to self (the blueprint the node is placed in). | — |
| FunctionName | FString | Name of the function whose timer's elapsed time should be checked, matched by string against the object's function table. | — |
Return Type
float Example
Show cooldown progress C++
float Elapsed = UKismetSystemLibrary::K2_GetTimerElapsedTime(this, TEXT("OnCooldownExpired"));
float Remaining = UKismetSystemLibrary::K2_GetTimerRemainingTime(this, TEXT("OnCooldownExpired"));
float Progress = Elapsed / (Elapsed + Remaining); See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?