FAudioDevice::CreateComponent

Creates an audio component to handle playing a sound.

Windows
MacOS
Linux

Deprecated

  • Use CreateComponent that passes a parameters block instead

References

Module

Engine

Header

/Engine/Source/Runtime/Engine/Public/AudioDevice.h

Include

#include "AudioDevice.h"

Source

/Engine/Source/Runtime/Engine/Private/AudioDevice.cpp

Syntax

static UAudioComponent * CreateComponent
(
    USoundBase * Sound,
    UWorld * World,
    AActor * Actor,
    bool bPlay,
    bool bStopWhenOwnerDestroyed,
    const FVector * Location,
    USoundAttenuation * AttenuationSettings,
    USoundConcurrency * ConcurrencySettings
)

Remarks

Creates an audio component to handle playing a sound. Plays a sound at the given location without creating an audio component.

Returns

The created audio component if the function successfully created one or a nullptr if not successful. Note: if audio is disabled or if there were no hardware audio devices available, this will return nullptr.

Parameters

Parameter

Description

Sound

The USoundBase to play at the location.

World

The world this sound is playing in.

AActor

The optional actor with which to play the sound on.

Play

Whether or not to automatically call play on the audio component after it is created.

bStopWhenOwnerDestroyed

Whether or not to automatically stop the audio component if its owner is destroyed.

Location

The sound's location.

AttenuationSettings

The sound's attenuation settings to use. Will default to the USoundBase's AttenuationSettings if not specified.

USoundConcurrency

The sound's sound concurrency settings to use. Will use the USoundBase's USoundConcurrency if not specified.

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss