AActor::WasRecentlyRendered
#include "GameFramework/Actor.h"
Access: public
Specifiers: constUFUNCTION
Description
Returns true if any of this actor's primitive components have been rendered within the last Tolerance seconds of game time. Commonly used to skip updates on off-screen actors.
Caveats & Gotchas
- • Returns false for actors that have never been rendered at all, even if they are in the camera frustum — render time is only updated once the GPU has actually processed the component, so this will read false on the first frame.
- • Uses game time, not wall-clock time — in slow-motion or paused scenarios the tolerance window stretches accordingly, potentially returning true for longer than expected.
- • An actor hidden via SetActorHiddenInGame(true) will have a stale LastRenderTime that grows over time, so this will return false quickly after hiding — be aware when toggling visibility dynamically.
Signature
UFUNCTION(Category="Rendering", BlueprintCallable, meta=(DisplayName="Was Actor Recently Rendered", Keywords="scene visible"))
ENGINE_API bool WasRecentlyRendered(float Tolerance = 0.2f) const Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Tolerance | float | How many seconds ago the last render time can be and still count as 'recently rendered'. Defaults to 0.2 seconds. | 0.2f |
Return Type
bool Example
Skip expensive AI update for off-screen enemies C++
void AMyEnemy::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
if (!WasRecentlyRendered(0.5f))
{
// Skip expensive perception and animation updates
return;
}
RunFullAIUpdate(DeltaTime);
} See Also
Tags
Version History
Introduced in: unknown
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?