Navigation
API > API/Runtime > API/Runtime/Engine > API/Runtime/Engine/UGameplayStatics
Description
This function allows users to create Audio Components in advance of playback with settings specifically for non-spatialized, non-distance-attenuated sounds. Audio Components created using this function by default will not have Spatialization applied.
| Name | CreateSound2D |
| Type | function |
| Header File | /Engine/Source/Runtime/Engine/Classes/Kismet/GameplayStatics.h |
| Include Path | #include "Kismet/GameplayStatics.h" |
| Source | /Engine/Source/Runtime/Engine/Private/GameplayStatics.cpp |
UFUNCTION (BlueprintCallable, BlueprintCosmetic, Category="Audio",
Meta=(WorldContext="WorldContextObject", AdvancedDisplay="2", UnsafeDuringActorConstruction="true", Keywords="play"))
static UAudioComponent * CreateSound2D
(
const UObject * WorldContextObject,
USoundBase * Sound,
float VolumeMultiplier,
float PitchMultiplier,
float StartTime,
USoundConcurrency * ConcurrencySettings,
bool bPersistAcrossLevelTransition,
bool bAutoDestroy
)
An audio component to manipulate the created sound
Parameters
| Name | Remarks |
|---|---|
| Sound | Sound to create. |
| VolumeMultiplier | A linear scalar multiplied with the volume, in order to make the sound louder or softer. |
| PitchMultiplier | A linear scalar multiplied with the pitch. |
| StartTime | How far into the sound to begin playback at |
| ConcurrencySettings | Override concurrency settings package to play sound with |
| PersistAcrossLevelTransition | Whether the sound should continue to play when the map it was played in is unloaded |
| bAutoDestroy | Whether the returned audio component will be automatically cleaned up when the sound finishes (by completing or stopping), or whether it can be reactivated |