RealDocs

UActorComponent::IsBeingDestroyed

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

Description

Returns true if the component has begun its destruction sequence but has not yet been fully destroyed. Useful to guard against use-after-destroy in async or deferred callbacks.

Caveats & Gotchas

  • This returns true from the moment BeginDestroy is entered through to garbage collection. If you hold a raw pointer to a component, this check is insufficient — prefer TWeakObjectPtr and IsValid() to detect pending destruction from external code.
  • Components being destroyed will still tick until their owning actor's EndPlay completes, so a ticking component may return true from IsBeingDestroyed during its own TickComponent.

Signature

UFUNCTION(BlueprintCallable, Category="Components", meta=(DisplayName="Is Component Being Destroyed"))
bool IsBeingDestroyed() const

Return Type

bool

Example

Guard a delegate callback against destroyed components C++
MyTimerHandle = GetWorld()->GetTimerManager().SetTimerForNextTick([WeakComp = TWeakObjectPtr<UMyComponent>(this)]()
{
	if (WeakComp.IsValid() && !WeakComp->IsBeingDestroyed())
	{
		WeakComp->DoWork();
	}
});

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.