# "WasRecentlyRendered" node returning true even after being occluded by walls

**URL:** <https://forums.unrealengine.com/t/wasrecentlyrendered-node-returning-true-even-after-being-occluded-by-walls/1870487>\
**Category:** Blueprint\
**Tags:** unreal-engine, editor, Rendering, Blueprint, question\
**Created:** [May 24, 2024, 8:15am UTC](https://forums.unrealengine.com/t/wasrecentlyrendered-node-returning-true-even-after-being-occluded-by-walls/1870487 "2024-05-24T08:15:21Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![NoobieTheGodInGa](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/noobiethegodinga/32/710746_2.png) [@NoobieTheGodInGa](https://forums.unrealengine.com/u/NoobieTheGodInGa)\
**Post date:** [May 24, 2024, 8:15am UTC](https://forums.unrealengine.com/t/wasrecentlyrendered-node-returning-true-even-after-being-occluded-by-walls/1870487/1 "2024-05-24T08:15:21Z")

</div>

So _WasRecentlyRendered_ node is buggy, whenever the game is played in rendered mode it returns true even when the actor is hidden behind walls **completely** but works fine in unlit mode (returns false behind walls).

And yes I even checked the rendering with _FreezeRendering_ console command, the target actor was completely un-rendered behind walls. what’s happening here?

---

<div class="post-metadata">

**Author:** ![robert2003b](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@robert2003b](https://forums.unrealengine.com/u/robert2003b)\
**Post date:** [May 30, 2024, 5:11am UTC](https://forums.unrealengine.com/t/wasrecentlyrendered-node-returning-true-even-after-being-occluded-by-walls/1870487/2 "2024-05-30T05:11:53Z")

</div>

From the information available, it appears that the WasRecentlyRendered node only takes into account the camera’s frustum for code-based optimization purposes and does not perform occlusion culling. This means that if the actor resides within the camera’s frustum, the node may return true, regardless of whether the actor is actually visible on the screen or not. [Official Site](https://www.mycoveredcalifornia.com) Additionally, there have been instances where other elements, such as game screen widgets or render targets for minimaps, have interfered with the expected behavior of the WasRecentlyRendered node.

---

<div class="post-metadata">

**Author:** ![NoobieTheGodInGa](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/noobiethegodinga/32/710746_2.png) [@NoobieTheGodInGa](https://forums.unrealengine.com/u/NoobieTheGodInGa)\
**Post date:** [May 31, 2024, 2:19pm UTC](https://forums.unrealengine.com/t/wasrecentlyrendered-node-returning-true-even-after-being-occluded-by-walls/1870487/3 "2024-05-31T14:19:57Z")

</div>

But then as I mentioned It works as expected in unlit mode (F2 key) while ingame, why is that?

---

<div class="post-metadata">

**Author:** ![Nerraw991](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Nerraw991](https://forums.unrealengine.com/u/Nerraw991)\
**Post date:** [December 7, 2024, 1:14am UTC](https://forums.unrealengine.com/t/wasrecentlyrendered-node-returning-true-even-after-being-occluded-by-walls/1870487/4 "2024-12-07T01:14:28Z")

</div>

I’m seeing something similar. It looks like it’s getting set as WasRecentlyRendered during the shadow pass. I suppose it’s rendering them into the shadow map and that counts as “recently rendered”

---

<div class="post-metadata">

**Author:** ![192445](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/192445/32/739979_2.png) [@192445](https://forums.unrealengine.com/u/192445)\
**Post date:** [January 3, 2025, 2:11am UTC](https://forums.unrealengine.com/t/wasrecentlyrendered-node-returning-true-even-after-being-occluded-by-walls/1870487/5 "2025-01-03T02:11:45Z")

</div>

Try this ‘UPrimitiveComponent::GetLastRenderTimeOnScreen’

---

<div class="post-metadata">

**Author:** ![TrollHaxYT](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TrollHaxYT](https://forums.unrealengine.com/u/TrollHaxYT)\
**Post date:** [April 3, 2025, 2:13pm UTC](https://forums.unrealengine.com/t/wasrecentlyrendered-node-returning-true-even-after-being-occluded-by-walls/1870487/6 "2025-04-03T14:13:12Z")

</div>

This worked for me!

```cpp
const auto& MeshComponent = *CurrentCritter->GetMesh();

const float& LastRenderTimeOnScreen = MeshComponent.GetLastRenderTimeOnScreen();

float TimeSinceRendered = GetWorldRef().GetTime().GetWorldTimeSeconds() - LastRenderTimeOnScreen;

if (LastRenderTimeOnScreen < 0.0f || TimeSinceRendered >= 3.0f)
{
// Hasn't been rendered in a while
}

```

Notes:  
If the component has never been rendered, _LastRenderTimeOnScreen_ will be -1000.0f.

Otherwise _LastRenderTimeOnScreen_ will be the _ **GetWorldTimeSeconds** _ of when it was rendered.

To get how long it has been since it was last rendered, you have to do the line **“float TimeSinceRendered…”**
