RealDocs

UGameplayStatics::SetSoundClassDistanceScale

function Engine Blueprint Since 4.0
#include "Kismet/GameplayStatics.h"
Access: public Specifiers: staticUFUNCTIONBlueprintCallableBlueprintCosmetic

Description

Scales the attenuation distance of all sounds belonging to a given SoundClass, optionally interpolating over time. A value greater than 1.0 makes sounds in that class audible at a greater range.

Caveats & Gotchas

  • BlueprintCosmetic — no effect on a dedicated server. This is purely a client-side audio tweak.
  • This is a runtime override layered on top of each sound's individual attenuation settings — it multiplies the existing attenuation distance rather than replacing it.
  • Passing a null SoundClass pointer will silently do nothing. Ensure you have a valid USoundClass asset reference before calling.

Signature

static ENGINE_API void SetSoundClassDistanceScale(const UObject* WorldContextObject, USoundClass* SoundClass, float DistanceAttenuationScale, float TimeSec = 0.0f);

Parameters

Name Type Description Default
WorldContextObject const UObject* Object used to retrieve the world context.
SoundClass USoundClass* The sound class to modify.
DistanceAttenuationScale float Scalar applied to the attenuation distance for all sounds in this class. 1.0 = unchanged, 2.0 = double the attenuation radius.
TimeSec float Time in seconds to interpolate to the new scale from the current value. 0.0f

Return Type

void

Example

Double the hearing range for ambient sounds C++
// AmbientSoundClass is a UPROPERTY(EditDefaultsOnly) USoundClass*
UGameplayStatics::SetSoundClassDistanceScale(this, AmbientSoundClass, 2.0f, 1.0f);

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.