RealDocs

UAudioComponent::GetSound

function Engine Since 5.0
#include "Components/AudioComponent.h"
Access: public Specifiers: override

Description

Returns the USoundBase currently assigned to this component's Sound property.

Caveats & Gotchas

  • Reflects whatever Sound is currently set, which may differ from what's actually playing if SetSound() was called after Play() started a different sound.
  • Not Blueprint-exposed — Blueprint graphs read the Sound property directly instead of calling a getter function.

Signature

USoundBase* GetSound() override

Return Type

USoundBase*

Example

Reading the assigned sound C++
if (USoundBase* CurrentSound = AudioComponent->GetSound())
{
	UE_LOG(LogTemp, Log, TEXT("Currently assigned sound: %s"), *CurrentSound->GetName());
}

Version History

Introduced in: 5.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.