UActorComponent::PreUnregisterComponentFromWorld
#include "Components/ActorComponent.h"
Access: public
Description
Pre-unregisters a component from the world when its level is being incrementally removed. Counterpart to PreRegisterComponentWithWorld — only called on components that opt in via ShouldIncrementalPreUnregister.
Caveats & Gotchas
- • Only invoked by the engine's incremental level unloading system — do not call manually. The component remains registered during the pre-unregister phase and can still tick and render.
- • Override OnPreUnregister or OnPreUnregistered to hook into this lifecycle phase rather than overriding this function directly.
Signature
ENGINE_API void PreUnregisterComponentFromWorld() Return Type
void Example
Override OnPreUnregister to start cleanup before unregistration C++
bool UMyHeavyComponent::ShouldIncrementalPreUnregister() const
{
return true;
}
void UMyHeavyComponent::OnPreUnregister()
{
Super::OnPreUnregister();
CancelAndWaitForAsyncWork(); // Drain async work before full unregistration
} Tags
Version History
Introduced in: 5.1
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?