Hi,
The following functions do not work in non-editor builds (due to FSceneProxyBase::SupportsAlwaysVisible):
- UPrimitiveComponent::GetLastRenderTime()
- UPrimitiveComponent::WasRecentlyRendered()
- AActor::GetLastRenderTime()
- AActor::WasRecentlyRendered()
They do not work properly (as expected from what I see in the code) when the primitive (or the actor contains any primitive) with a nanite static mesh.
We are considering adding a simple workaround like so, are there plans to handle this case in future versions of UE (this was raised here already: [Content removed]
These functions are really useful, however I understand that Nanite means GPU path, do you see a big performance impact in disabling the always visible path on a few nanite static mesh primitive components ? As a workaround, we could also create a dummy non-nanite primitive component to retrieve last draw time info if you think it’s really worth avoiding this workaround.
( bAllowAlwaysVisible being a property added to UPrimitiveComponent ).
void UPrimitiveComponent::AssignSceneProxy(FPrimitiveSceneProxy* InSceneProxy)
{
check(SceneProxy == nullptr && SceneData.SceneProxy == nullptr);
SceneProxy = InSceneProxy;
SceneData.SceneProxy = InSceneProxy;
if (SceneProxy)
{
--> SceneData.bAlwaysVisible = bAllowAlwaysVisible && SceneProxy->IsAlwaysVisible();
SceneData.OwnerLastRenderTimePtr = FActorLastRenderTime::GetPtr(GetOwner());
if (SceneData.bAlwaysVisible && SceneData.OwnerLastRenderTimePtr)
{
SceneData.OwnerLastRenderTimePtr->NumAlwaysVisibleComponents.fetch_add(1, std::memory_order_relaxed);
}
#if WITH_EDITOR
if (bWantsEditorEffects)
{
SetOverlayColor(OverlayColor);
}
#endif
}
}
Thanks in advance,
Hugo