UAudioComponent::EndPlay
#include "Components/AudioComponent.h"
Access: public
Specifiers: virtualoverride
Description
Called when the audio component's owning actor ends play, allowing it to stop its sound and clean up before the component or its owner is destroyed.
Caveats & Gotchas
- • This overrides UActorComponent::EndPlay, not a sound-specific callback — it fires regardless of whether the component is currently playing, so don't assume a sound was active.
- • If you override this in a derived component, call Super::EndPlay() first so the base implementation can stop playback and issue delegates before your own cleanup runs.
Signature
ENGINE_API virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override; Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| EndPlayReason | const EEndPlayReason::Type | Why the component's play state is ending (destruction, level transition, removed from world, etc.). | — |
Return Type
void Example
Override EndPlay in a derived audio component C++
void UMyAudioComponent::EndPlay(const EEndPlayReason::Type EndPlayReason)
{
Super::EndPlay(EndPlayReason);
// Additional cleanup here
} See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?