Skip to main content

Function: addAudioComponent()

addAudioComponent(world, entity, options): AudioEcsComponent

Defined in: audio/components/audio-component.ts:50

Attaches a AudioEcsComponent to entity.

Parameters​

world​

EcsWorld

The ECS world entity belongs to.

entity​

number

The entity to attach the component to.

options​

AudioRequiredOptions & Partial<AudioEcsComponent>

Options for configuring the audio. sound has no sensible default and must always be provided.

Returns​

AudioEcsComponent

The attached component, for further tuning or runtime changes.