Home › Modules › AFM_AutoDestroy
Module

AFM_AutoDestroy

Destroys the owning actor when the actor it depends on is destroyed.

What it gives you

  • Automatic cleanup of helper actors
  • No manual lifetime tracking

Requires

None

Required by

AFM_Abilities AFM_MeshCopy AFM_Spline AFM_State AFM_WidgetInteraction AFS_Core_MotionController AFS_Core_Snapping AFS_UI AFS_UI_Hand AFS_UI_Labels AFS_UI_Pawn AFS_UX_Gaze AFS_UX_Grip AFS_UX_Laser AFS_UX_Locomotion AFS_UX_Select AFS_UX_Teleporter AF_Examples

1 assets1 API members

Description

Many framework systems spawn helper actors — motion controllers, previews, indicators, cursors — that should not outlive whatever created them. BPC_AutoDestroy binds to the parent's destruction and removes its owner, so no system has to track those lifetimes manually.

Setup

  1. Add BPC_AutoDestroy to any actor that should not outlive its parent.

Usage

Add the component and set the owning actor. When that actor is destroyed, this one follows. There is nothing to call.

Key properties

PropertyWhen to change
OwnerSet at spawn time by whatever creates the helper

Extending

Not typically extended.

Example map

Present on BP_MotionController so hands clean up with the pawn.

Troubleshooting

Helper actors survive their parent. The component is missing, or the owner was never assigned at spawn.

API reference

Every blueprint asset in this module. Expand an asset to see its members.

Components

BPC_AutoDestroy1 members
extends ActorComponent

Lifetime component for spawned helper actors: at begin play it binds to the owning actor's own owner and destroys the helper when that owner goes. Nearly every helper the framework spawns carries one, and you should add it to any helper of your own that is spawned with an owner. With no owner it prints a warning and does nothing.

KindNameSignatureDescription
eventOnDestroyed_Event(DestroyedActor: Actor)Destroys the owning actor when the actor it depends on is destroyed. Used so helper actors such as motion controllers clean up with their pawn.