RealDocs

AActor::InvalidateLightingCache

function Engine Since 4.0
#include "GameFramework/Actor.h"
Access: public Specifiers: inline

Description

Invalidates the cached static lighting for this actor using default options. In editor builds, delegates to InvalidateLightingCacheDetailed(false). No-ops at runtime.

Caveats & Gotchas

  • This is a no-op outside the editor (guarded by GIsEditor && !GIsDemoMode) — calling it in a shipping build does nothing and is safe but wasteful.
  • The underlying InvalidateLightingCacheDetailed(false) marks all lightmap data as dirty, requiring a lighting rebuild. Overuse in editor tools will force frequent lighting rebuilds.
  • If you only moved the actor (translation only), prefer calling InvalidateLightingCacheDetailed(true) directly to skip full re-computation of non-translation-dependent lighting data.

Signature

void InvalidateLightingCache()

Return Type

void

Example

Invalidate lighting after programmatically moving an actor in the editor C++
#if WITH_EDITOR
void AMyEditorActor::MoveAndInvalidate(FVector NewLocation)
{
    SetActorLocation(NewLocation);
    InvalidateLightingCache(); // Mark baked lighting as stale
}
#endif

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.