AActor::GetLastRenderTime
#include "GameFramework/Actor.h"
Access: public
Specifiers: virtual
Description
Returns the most recent game time (in seconds) at which any of this actor's components were rendered. Compare against UWorld::GetTimeSeconds() to determine how long ago the actor was last visible.
Caveats & Gotchas
- • Returns 0.0f if the actor has never been rendered — compare against GetWorld()->GetTimeSeconds() and account for this case to avoid treating a never-rendered actor as recently visible.
- • The value is updated by the rendering thread asynchronously — there can be up to one frame of lag between the actor being rendered and this value reflecting it.
- • In UE 5.6, the underlying LastRenderTime field on FActorLastRenderTime was deprecated; this virtual function now reads through that struct's accessor, so subclasses overriding it should still call Super or replicate the struct read.
Signature
ENGINE_API virtual float GetLastRenderTime() const Return Type
float Example
Compute seconds since last render C++
float AMyActor::SecondsSinceRendered() const
{
const float LastRender = GetLastRenderTime();
if (LastRender <= 0.f)
{
return TNumericLimits<float>::Max(); // Never rendered
}
return GetWorld()->GetTimeSeconds() - LastRender;
} See Also
Tags
Version History
Introduced in: unknown
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | Underlying FActorLastRenderTime::LastRenderTime field deprecated; access via this function. |
Feedback
Was this helpful?