Audio
Manages and controls all audio-related functionalities within the game engine, including playing music and sounds, and adjusting their properties.
Properties
Indicates whether any audio is currently being played.
Represents the current intensity of the music playing.
Methods
Returns the current music intensity within a specified range.
Parameters
low
The lower bound of the intensity range.
high
The upper bound of the intensity range.
normalizeVolume
Whether to normalize the intensity within the specified range.
Returns
The current music intensity, possibly normalized.
Temporarily lowers the music volume.
Parameters
duration
The duration to lower the music volume.
duckOutDuration
Duration for the volume to fade out to the ducked level.
duckInDuration
Duration for the volume to return to normal after the specified duration.
Returns
Plays music using an AudioShader.
Parameters
shader
AudioShaderThe AudioShader to play.
volume
The volume at which to play the music.
Returns
Plays music from a specified URL.
Parameters
url
The URL of the music to play.
volume
The volume at which to play the music.
Returns
Stops currently playing music, with an optional fade-out.
Parameters
fadeOut
Whether to fade out the music instead of stopping abruptly.
Returns
Plays an audio effect using an AudioShader.
Parameters
shader
AudioShaderThe AudioShader to use for playing the sound.
Returns
Plays a sound effect globally, without spatialization.
Parameters
shader
AudioShaderThe AudioShader to play.
volume
The volume at which to play the sound.
pitch
The pitch at which to play the sound.
spatialize
Whether to spatialize the sound. False plays the sound globally.
loop
Whether the sound should loop.
Returns
The AudioSource instance representing the played sound.
Plays a sound effect attached to a specific game object.
Parameters
shader
AudioShaderThe AudioShader to play.
gameObject
GameObjectThe GameObject to which the sound is attached.
volume
The volume at which to play the sound.
pitch
The pitch of the sound.
spatialize
Whether the sound should be spatialized according to the game object's position.
Returns
The AudioSource instance representing the played sound.
Stops a specific audio source.
Parameters
source
AudioSourceThe AudioSource to stop.