UActorComponent::K2_DestroyComponent
#include "Components/ActorComponent.h"
Access: public
Specifiers: UFUNCTIONBlueprintCallable
Description
Blueprint-callable version of DestroyComponent. Enforces that only the component itself or its owning actor may initiate destruction, preventing arbitrary external objects from deleting components they don't own.
Caveats & Gotchas
- • The Object parameter acts as a permission check: if Object is not the component or its owner, the call is silently ignored. Pass self from Blueprint to destroy a component from within that component's graph.
- • Unlike the C++ DestroyComponent, K2_DestroyComponent does not accept a bPromoteChildren argument — children are always destroyed along with the component when called from Blueprint.
Signature
ENGINE_API void K2_DestroyComponent(UObject* Object) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Object | UObject* | The object requesting the destruction. Defaults to self (the component) via the DefaultToSelf meta specifier. Used to verify that only the owning actor or the component itself can destroy the component. | — |
Return Type
void Example
Destroying a component from Blueprint text
// In a Blueprint Actor's event graph:
// Self → Destroy Component node (target = the component variable, Object pin = Self)
// This is the standard way to remove a dynamically added component from Blueprint. See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?