Constructor
Sound.Default Constructor
Syntax
Sound(location, asset, is_2D_sound = false, auto_destroy = true, sound_type = SoundType.SFX, volume = 1, pitch = 1, inner_radius = 400, falloff_distance = 3600, attenuation_function = Linear, keep_playing_when_silent = false, loop_mode = Default, auto_play = true)
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
location
|
Vector | — | Only used if 3D sound |
asset
|
SoundPath | — | The Sound Asset to load |
is_2D_sound
optional
|
boolean | false |
Whether to spawn it as 2D or 3D |
auto_destroy
optional
|
boolean | true |
Whether to destroy after finished playing |
sound_type
optional
|
SoundType | SoundType.SFX |
Used to apply user's volume settings |
volume
optional
|
float | 1 |
— |
pitch
optional
|
float | 1 |
— |
inner_radius
optional
|
float | 400 |
Only used if 3D sound |
falloff_distance
optional
|
float | 3600 |
Only used if 3D sound |
attenuation_function
optional
|
AttenuationFunction | Linear |
Only used if 3D sound |
keep_playing_when_silent
optional
|
boolean | false |
Only used if 3D sound - Use with caution, it may cause performance issues! |
loop_mode
optional
|
SoundLoopMode | Default |
Whether should force sound to loop |
auto_play
optional
|
boolean | true |
If should should immediately play when loaded |