RealDocs

UAudioComponent::GetAudioComponentFromID

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

Description

Looks up the audio component instance matching a given runtime ID, using the engine's global ID-to-component map.

Caveats & Gotchas

  • Returns nullptr if no live component matches the ID — components are removed from the internal map on destruction, so a stale ID silently fails rather than returning a dangling pointer.
  • Access to the underlying map is guarded by a critical section (AudioIDToComponentMapLock), making this safe to call from audio-render-thread callbacks, unlike dereferencing a raw UAudioComponent* captured earlier.

Signature

static ENGINE_API UAudioComponent* GetAudioComponentFromID(uint64 AudioComponentID);

Parameters

Name Type Description Default
AudioComponentID uint64 The runtime ID previously obtained from GetAudioComponentID().

Return Type

UAudioComponent*

Example

Resolve a component from a stored ID C++
if (UAudioComponent* Comp = UAudioComponent::GetAudioComponentFromID(StoredComponentID))
{
    Comp->SetVolumeMultiplier(0.5f);
}
else
{
    // Component no longer exists
}

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.