UAudioComponent::SetSound
#include "Components/AudioComponent.h"
Access: public
Specifiers: UFUNCTIONBlueprintCallable
Description
Changes which USoundBase this component will play, replacing the current value of the Sound property.
Caveats & Gotchas
- • Calling this while the component is already playing does not restart or retrigger playback with the new sound — it only takes effect the next time Play is called.
- • Passing nullptr clears the assigned sound; calling Play() afterward with no sound set is a silent no-op rather than an error or warning.
Signature
void SetSound(USoundBase* NewSound) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| NewSound | USoundBase* | The sound asset this component should play going forward. | — |
Return Type
void Example
Swap and play a new sound C++
AudioComp->Stop();
AudioComp->SetSound(FootstepConcreteCue);
AudioComp->Play(); See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?