UGameplayStatics::SpawnDialogueAtLocation
#include "Kismet/GameplayStatics.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintCallable
Description
Spawns a spatialized UAudioComponent for a UDialogueWave at a fixed world position, begins playback, and returns the component for runtime control. The component stays at the spawn location — it does not follow any actor.
Caveats & Gotchas
- • Unlike SpawnDialogueAttached, the component does not move after spawn; use SpawnDialogueAttached if the dialogue source is a moving character.
- • Returns nullptr if concurrency limits are hit or if the context resolves to no SoundBase; always null-check before interacting with the result.
- • Subtitles will only be rendered if enabled via SetSubtitlesEnabled; the component itself has no influence over subtitle display.
Signature
static ENGINE_API UAudioComponent* SpawnDialogueAtLocation(const UObject* WorldContextObject, UDialogueWave* Dialogue, const struct FDialogueContext& Context, FVector Location, FRotator Rotation = FRotator::ZeroRotator, float VolumeMultiplier = 1.f, float PitchMultiplier = 1.f, float StartTime = 0.f, USoundAttenuation* AttenuationSettings = nullptr, bool bAutoDestroy = true) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| WorldContextObject | const UObject* | Object used to obtain the world context. | — |
| Dialogue | UDialogueWave* | The dialogue wave asset to spawn. | — |
| Context | const struct FDialogueContext& | Speaker and target context to resolve the audio variation. | — |
| Location | FVector | World-space position for the audio component. | — |
| Rotation | FRotator | Orientation of the audio source. | FRotator::ZeroRotator |
| VolumeMultiplier | float | Linear scalar applied to the volume. | 1.f |
| PitchMultiplier | float | Linear scalar applied to the pitch. | 1.f |
| StartTime | float | Offset in seconds into the dialogue to begin playback. | 0.f |
| AttenuationSettings | USoundAttenuation* | Optional attenuation override asset. | nullptr |
| bAutoDestroy | bool | Automatically destroy the component when playback ends. | true |
Return Type
UAudioComponent* Example
Spawn interruptible dialogue at a world location C++
FDialogueContext Ctx;
Ctx.Speaker = GuardVoice;
Ctx.Targets.Add(PlayerVoice);
UAudioComponent* DialogueComp = UGameplayStatics::SpawnDialogueAtLocation(
this, AlertWave, Ctx, GuardLocation, FRotator::ZeroRotator,
1.f, 1.f, 0.f, nullptr, false);
if (DialogueComp)
{
ActiveGuardDialogue = DialogueComp;
} Tags
Version History
Introduced in: 4.9
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?