RealDocs

UAudioComponent::Activate

function Engine Since 4.0
#include "Components/AudioComponent.h"
Access: public Specifiers: virtualoverride

Description

Activates the component, which for UAudioComponent begins playing the assigned Sound if bAutoActivate is set or Activate() is called explicitly.

Caveats & Gotchas

  • Calling Activate() is not the same as calling Play() directly — Activate() is the ActorComponent-level entry point that auto-activation and construction-script wiring use, and it internally starts playback for an audio component.
  • On a dedicated server, auto-activation via bAutoActivate is skipped for audio components even when bAutoManageAttachment is set, since server-side sound playback is meaningless.
  • Override this in a derived component and always call Super::Activate(bReset) first, or the underlying sound will never start.

Signature

virtual void Activate(bool bReset=false) override

Parameters

Name Type Description Default
bReset bool If true, forces re-activation logic to run even if the component is already active. false

Return Type

void

Example

Activate a manually-constructed audio component C++
UAudioComponent* Comp = NewObject<UAudioComponent>(this);
Comp->SetSound(MySound);
Comp->RegisterComponent();
Comp->Activate(true);

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.