AActor::ResetOwnedComponents
#include "GameFramework/Actor.h"
Access: public
Description
Clears and rebuilds the OwnedComponents set by walking the actor's full component hierarchy. Used to repair the set after undo/redo operations invalidate it.
Caveats & Gotchas
- • This is an expensive operation — it clears and re-traverses all children. Never call it in a hot path or per-tick; it exists for editor undo/redo and serialization recovery.
- • Calling this at runtime on a server-replicated actor can temporarily desync component lists between the authority and proxies if a replication tick fires mid-rebuild.
- • The function comment states it should rarely be called directly. If you find yourself needing it outside of undo/redo code, that is a signal that component ownership is being managed incorrectly.
Signature
void ResetOwnedComponents() Return Type
void Example
Usage in a custom PostEditUndo override C++
#if WITH_EDITOR
void AMyActor::PostEditUndo()
{
Super::PostEditUndo();
// Ensure component set is coherent after undo
ResetOwnedComponents();
}
#endif Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?