UAudioComponent::AutoAttachLocationRule
#include "Components/AudioComponent.h"
Access: public
Specifiers: UPROPERTYEditAnywhereBlueprintReadWrite
Description
Controls how this component's location is handled when it auto-attaches to AutoAttachParent, if bAutoManageAttachment is true.
Caveats & Gotchas
- • Only takes effect when bAutoManageAttachment is enabled; otherwise this setting is stored but never applied.
- • Using EAttachmentRule::KeepWorld preserves the current world location on attach, while SnapToTarget snaps to the parent/socket origin — picking the wrong rule is a common cause of sounds appearing to 'jump' when auto-attach triggers.
Signature
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Attachment, meta = (EditCondition = "bAutoManageAttachment"))
EAttachmentRule AutoAttachLocationRule; Example
Snap to the socket on auto-attach C++
AudioComponent->bAutoManageAttachment = true;
AudioComponent->AutoAttachLocationRule = EAttachmentRule::SnapToTarget;
AudioComponent->AutoAttachRotationRule = EAttachmentRule::SnapToTarget;
AudioComponent->AutoAttachScaleRule = EAttachmentRule::KeepWorld; See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?