Skip to main content

Sound

The sound component controls the playback of audio samples.

Sound component

Each sound component contains "slots" responsible for sound playback. Each slot can have a different audio asset assigned and can be played independently of other slots.

You can click the "ADD SLOT" button to add a new slot. You can remove a slot by clicking the trash icon in each slot's header.

The sound component can be enabled or disabled using the toggle in the top-right of the component panel. When enabled, the component plays slots marked for auto-play. The remaining slots can be played through scripts.

Component Properties

PropertyDescription
PositionalWhen selected, the component plays audio assets as if they are playing from the entity's position in 3D space.
VolumeThe volume that will be multiplied with each slot's volume when playing audio assets.
PitchThe pitch that will be multiplied with each slot's pitch when playing audio assets. A value of 1 means the audio plays at its original pitch.
Ref DistanceThe reference distance for reducing volume when the sound source moves away from the listener.
Max DistanceThe maximum distance from the listener at which audio attenuation stops. The audio volume is not necessarily 0 after this distance, but it no longer attenuates.
Distance ModelDetermines the algorithm to use for reducing volume when the sound moves away from the listener. Can be Linear, Inverse, or Exponential.
Roll-off FactorThe rate at which volume attenuation occurs.

Slot Properties

PropertyDescription
NameThe name of the slot. Used to reference this slot in code.
AssetThe audio asset to play.
Start TimeThe start time when the sound begins playing.
DurationThe duration of the sound that the slot will play from Start Time.
Auto PlayWhen selected, the slot plays when loaded. Otherwise, you must play the slot using scripts.
OverlapWhen selected, this slot plays sounds without stopping first. Overlap should be used for one-shot sounds that need to be played repeatedly. Overlapping sounds do not stop when the entity is destroyed and only stop when completed or manually stopped from scripts.
LoopWhen selected, the slot repeats continuously. Otherwise, it plays once until completion.
VolumeThe volume of the audio asset played in the slot.
PitchThe pitch at which the audio is played. A value of 1 means the audio plays at its original pitch.

Scripting Interface

You can control the sound component's properties using a script component. The sound component's scripting interface is here.