UAudioComponent
Inherits: UObjectBase › UObjectBaseUtility › UObject › UActorComponent › USceneComponent › UAudioComponent
#include "Components/AudioComponent.h" Description
A scene component that plays a USoundBase asset at the component's world location with full control over volume, pitch, 3D spatialization, fade transitions, and runtime parameters.
Caveats & Gotchas
- • bAutoDestroy causes the component to be destroyed after playback ends. It is set automatically by UGameplayStatics::SpawnSoundAtLocation — never set it on persistent audio components you intend to reuse.
- • IsPlaying() returns false when paused or fading. Use GetPlayState() to query EAudioComponentPlayState for the full status.
- • Parameter changes via SetFloatParameter/SetBoolParameter are silently dropped when bDisableParameterUpdatesWhilePlaying is true.
- • Attaching audio to fast-moving skeletal meshes can cause spatialization lag. For fire-and-forget 3D sounds, prefer UGameplayStatics::PlaySoundAtLocation.
Example
Play ambient audio with a fade-in C++
// Persistent component set up in constructor:
// AmbientComp = CreateDefaultSubobject<UAudioComponent>(TEXT("AmbientComp"));
AmbientComp->SetSound(AmbientLoopSound);
AmbientComp->FadeIn(2.0f, 1.0f); Functions (4)
Audio 4 ▼
| Access | Type | Name |
|---|---|---|
| public | function | UAudioComponent::FadeIn |
| public | function | UAudioComponent::FadeOut |
| public | function | UAudioComponent::Play |
| public | function | UAudioComponent::Stop |
See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?