UAudioComponent::Play
#include "Components/AudioComponent.h"
Access: public
Specifiers: virtualUFUNCTIONBlueprintCallable
Description
Starts playing the component's assigned Sound asset from StartTime. If the sound is already playing, it restarts.
Signature
virtual void Play(float StartTime = 0.0f) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| StartTime | float | Offset in seconds into the sound at which to begin playback. | 0.0f |
Return Type
void Caveats & Gotchas
- • If Sound is null, Play() does nothing — always assign Sound before calling Play.
- • Restarting a looping sound via Play() causes a brief audio discontinuity. Use FadeOut followed by FadeIn for smooth transitions.
- • StartTime seeking is not supported by all codecs. ADPCM does not support seek; use PCM or BinkAudio if you need reliable StartTime offsets.
Examples
Simple play from beginning C++
MyAudioComp->Play(); Seek into the middle of a clip C++
// Start 5 seconds into the sound
MyAudioComp->Play(5.0f); Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?