UAudioComponent::AutoAttachParent
#include "Components/AudioComponent.h"
Access: public
Specifiers: UPROPERTYVisibleInstanceOnlyBlueprintReadWrite
Description
The component this audio component automatically attaches to when activated, if bAutoManageAttachment is true.
Caveats & Gotchas
- • Only takes effect when bAutoManageAttachment is enabled — setting this alone with auto-management off has no effect on attachment.
- • If left null while bAutoManageAttachment is true, the component keeps its current AttachParent and defers attachment until it is activated, rather than detaching.
Signature
UPROPERTY(VisibleInstanceOnly, BlueprintReadWrite, Category=Attachment, meta=(EditCondition="bAutoManageAttachment"))
TWeakObjectPtr<USceneComponent> AutoAttachParent; Example
Auto-attach to a socket on activation C++
AudioComponent->bAutoManageAttachment = true;
AudioComponent->AutoAttachParent = GetMesh();
AudioComponent->AutoAttachSocketName = TEXT("WeaponSocket");
AudioComponent->Play(); See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?