UGameplayStatics::SetSoundMixClassOverride
#include "Kismet/GameplayStatics.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintCallable
Description
Adds or replaces a sound class adjuster in an active sound mix at runtime, allowing volume and pitch of an entire sound class to be changed dynamically with a smooth fade. If the sound class is not already in the mix it is added.
Caveats & Gotchas
- • The InSoundMixModifier must be currently active (pushed via PushSoundMixModifier or set as base mix); calling this on an inactive mix has no audible effect.
- • Overrides are cleared when the mix is popped via PopSoundMixModifier; for persistent changes use a dedicated override mix rather than piggy-backing on a transient one.
- • bApplyToChildren can cause unintended side-effects if your sound class hierarchy is wide — test with a specific class first before enabling child propagation in production.
Signature
static ENGINE_API void SetSoundMixClassOverride(const UObject* WorldContextObject, class USoundMix* InSoundMixModifier, class USoundClass* InSoundClass, float Volume = 1.0f, float Pitch = 1.0f, float FadeInTime = 1.0f, bool bApplyToChildren = true) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| WorldContextObject | const UObject* | Object used to obtain the world context. | — |
| InSoundMixModifier | class USoundMix* | The sound mix to add or modify the override in. | — |
| InSoundClass | class USoundClass* | The sound class whose adjuster should be overridden or added. | — |
| Volume | float | Target volume scalar for the override. | 1.0f |
| Pitch | float | Target pitch scalar for the override. | 1.0f |
| FadeInTime | float | Time in seconds to interpolate from the current adjuster values to the override values. | 1.0f |
| bApplyToChildren | bool | Whether to recursively apply the override to child sound classes. | true |
Return Type
void Example
Duck music volume during dialogue C++
// Push the mix first, then override the music class volume
UGameplayStatics::PushSoundMixModifier(this, DialogueMix);
UGameplayStatics::SetSoundMixClassOverride(
this, DialogueMix, MusicSoundClass,
0.3f, 1.0f, 0.5f, false); See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?