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
| Parameter | Type | Description |
|---|---|---|
component | UObjectProxy | Component to destroy. |
actor | ActorReference | Owning actor proxy, string query, or actor descriptor. |
name | string | Component name used with the actor overload. |
Returns
| Type | Description |
|---|---|
boolean | true after Unreal accepts the destroy request. |
nil, string | The 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.