AActor::ClearCrossLevelReferences
#include "GameFramework/Actor.h"
Access: public
Specifiers: virtual
Description
Clears any references this actor holds to objects in other levels. Called automatically by ULevel::PreSave before a level is serialized to disk.
Caveats & Gotchas
- • This is an engine-internal hook called during level save operations — you should not call it manually in gameplay code. Overriding it without calling Super:: will cause cross-level references to persist incorrectly into the saved asset.
- • Only relevant in editor builds; the cross-level reference cleanup it performs has no meaningful analogue at runtime. If you override it, guard the override body with #if WITH_EDITOR.
Signature
virtual void ClearCrossLevelReferences() Return Type
void Example
Override to clear custom cross-level references C++
#if WITH_EDITOR
void AMyActor::ClearCrossLevelReferences()
{
Super::ClearCrossLevelReferences();
// Null out any UObject* member that may point into another level
CrossLevelActorRef = nullptr;
}
#endif See Also
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?