Class AudioManager

A set of utilities that allow you to quickly play an Audio Clip with configuration.

Audio sources are pooled for improved performance.

Methods

  • Plays an audio resource. It will play positionally if a position is supplied in the config. Otherwise the audio will play globally.

    Parameters

    • audioResource: AudioResource

      Audio resource to play. This can be either an AudioClip or an AudioRandomConatiner.

    • Optional config: PositionalPlaySoundConfig

      Configure how the sound is played.

    Returns undefined | AudioSource

  • Loads an Audio Clip from path and plays it globally.

    Parameters

    • sound: string

      Path to audio clip. Must be under Resources folder or else it won't exist in published game.

    • Optional config: PlaySoundConfig

      Audio Source configuration

    Returns undefined | AudioSource

    Spawned Audio Source playing the clip (or undefined if the clip can't be loaded).