RealDocs

UActorComponent::OnActorVisibilityChanged

function Engine Since 4.0
#include "Components/ActorComponent.h"
Access: public Specifiers: virtual

Description

Called on each component when the owning actor's visibility state changes. The base implementation calls MarkRenderStateDirty to propagate the change to the renderer.

Caveats & Gotchas

  • The base implementation unconditionally calls MarkRenderStateDirty(). If you override this without calling Super, you must manually handle render state invalidation or visibility changes will not propagate to the scene proxy.
  • This is called for every component on the actor, including non-rendering components. Guard any rendering-specific logic with IsRenderStateCreated() to avoid no-op flushes.

Signature

virtual void OnActorVisibilityChanged()

Return Type

void

Example

Reacting to actor visibility change C++
void UMyComponent::OnActorVisibilityChanged()
{
	Super::OnActorVisibilityChanged(); // marks render state dirty
	// Additional logic — e.g. pause audio when actor becomes hidden
	if (GetOwner() && !GetOwner()->IsHidden())
	{
		ResumeAudio();
	}
	else
	{
		PauseAudio();
	}
}

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.