components.delete

Destroys a component through its owning actor.

Aliases: ue.components.destroy and ue.delete_component.

Syntax

ue.components.delete(component: UObjectProxy) -> boolean?, string?
ue.components.delete(actor: ActorReference, name: string) -> boolean?, string?

Parameters

ParameterTypeDescription
componentUObjectProxyComponent to destroy.
actorActorReferenceOwning actor proxy, string query, or actor descriptor.
namestringComponent name used with the actor overload.

Returns

TypeDescription
booleantrue after Unreal accepts the destroy request.
nil, stringThe component/owner is unavailable or destruction failed.

Example

local temporary = assert(ue.create_component(
    assert(ue.get_player_character()),
    "/Script/Engine.PointLightComponent"
))

assert(ue.delete_component(temporary))

-- Actor plus component-name overload:
assert(ue.components.delete("Player", "TemporaryComponent"))

The helper calls K2_DestroyComponent with the owning actor, preserving Unreal's component ownership check. The proxy is weak and becomes invalid after Unreal completes destruction.

On this page