Audio Manager

CarterGames.AudioManager.Runtime

CarterGames.Assets.AudioManager

Properties

Returns bool
Toggles whether or not the manager can play audio. This doesn’t effect other Audio Manager instances or the other player scripts.

Returns int
Gets the number of clips currently in this instance of the Audio Manager.

Returns AudioClip
Picks a random sound from the current Audio Manager File and returns it.

Returns AudioManagerFile
Gets the current Audio Manager File in use.

Methods

public bool HasClip(string clip);

Checks to see if a clip exists in the audio manager library.
Returns bool โ†’ Whether or not the clip was found.

if (AudioManager.instance.HasClip("MyClip"))
{
		// Do some stuff...
}
public bool IsClipPlaying(string clip);

Checks to see if the clip in question is playing.
Returns bool โ†’ Whether or not the clip is currently playing.

if (AudioManager.instance.IsClipPlaying("MyClip"))
{
		// Do some stuff...
}
public void Play(string clip, float volume = 1f, float pitch = 1f);
public void Play(string clip, AudioMixerGroup mixerGroup, float volume = 1f, float pitch = 1f);
public void Play(string clip, int mixerId, float volume = 1f, float pitch = 1f);
public void Play(string clip, AudioArgs args);

Plays the requested clip with optional values for volume and pitch. There are several overload methods are also available for audio mixers, either by manual assignment or via the audio manager mixer ID number.

AudioManager.instance.Play("MyClip");
AudioManager.instance.Play("MyClip", mixer);
AudioManager.instance.Play("MyClip", mixerID);
AudioManager.instance.Play("MyClip", args);
public AudioSource PlayAndGetSource(string clip, float volume = 1f, float pitch = 1f);
public AudioSource PlayAndGetSource(string clip, AudioMixerGroup mixerGroup, float volume = 1f, float pitch = 1f);
public AudioSource PlayAndGetSource(string clip, int mixerId, float volume = 1f, float pitch = 1f);
public AudioSource PlayAndGetSource(string clip, AudioArgs args);

Returns: AudioSource

Play a sound that is scanned into the audio manager and return the audio source the clip is on for you to check / use as needed. There are several overload methods are also available for audio mixers, either by manual assignment or via the audio manager mixer ID number.

var source = AudioManager.instance.PlayAndGetSource("MyClip");
var source = AudioManager.instance.PlayAndGetSource("MyClip", mixer);
var source = AudioManager.instance.PlayAndGetSource("MyClip", mixerID);
var source = AudioManager.instance.PlayAndGetSource("MyClip", args);
public void PlayFromTime(string clip, float time, float volume = 1f, float pitch = 1f);
public void PlayFromTime(string clip, float time, AudioMixerGroup mixerGroup, float volume = 1f, float pitch = 1f);
public void PlayFromTime(string clip, float time, int mixerId, float volume = 1f, float pitch = 1f);
public void PlayFromTime(string clip, float time, AudioArgs args);

Plays the requested clip with optional values for volume and pitch from the set time, handy if the clip doesnโ€™t start right away. There are several overload methods are also available for audio mixers, either by manual assignment or via the audio manager mixer ID number.

AudioManager.instance.PlayFromTime("MyClip", 0.1f);
AudioManager.instance.PlayFromTime("MyClip", 0.1f, mixer);
AudioManager.instance.PlayFromTime("MyClip", 0.1f, mixerID);
AudioManager.instance.PlayFromTime("MyClip", 0.1f, args);
public AudioSource PlayFromTimeAndGetSource(string clip, float time, float volume = 1f, float pitch = 1f);
public AudioSource PlayFromTimeAndGetSource(string clip, float time, AudioMixerGroup mixerGroup, float volume = 1f, float pitch = 1f);
public AudioSource PlayFromTimeAndGetSource(string clip, float time, int mixerId, float volume = 1f, float pitch = 1f);
public AudioSource PlayFromTimeAndGetSource(string clip, float time, AudioArgs args);

Returns: AudioSource

Plays the requested clip with optional values for volume and pitch from the set time, handy if the clip doesnโ€™t start right away. There are several overload methods are also available for audio mixers, either by manual assignment or via the audio manager mixer ID number.

var source = AudioManager.instance.PlayFromTimeAndGetSource("MyClip", 0.1f);
var source = AudioManager.instance.PlayFromTimeAndGetSource("MyClip", 0.1f, mixer);
var source = AudioManager.instance.PlayFromTimeAndGetSource("MyClip", 0.1f, mixerID);
var source = AudioManager.instance.PlayFromTimeAndGetSource("MyClip", 0.1f, args);
public void PlayWithDelay(string clip, float delay, float volume = 1f, float pitch = 1f);
public void PlayWithDelay(string clip, float delay, AudioMixerGroup mixerGroup, float volume = 1f, float pitch = 1f);
public void PlayWithDelay(string clip, float delay, int mixerId, float volume = 1f, float pitch = 1f);
public void PlayWithDelay(string clip, float delay, AudioArgs args);

Plays the requested clip with optional values for volume and pitch after the entered delay. There are several overload methods are also available for audio mixers, either by manual assignment or via the audio manager mixer ID number.

AudioManager.instance.PlayWithDelay("MyClip", 0.1f);
AudioManager.instance.PlayWithDelay("MyClip", 0.1f, mixer);
AudioManager.instance.PlayWithDelay("MyClip", 0.1f, mixerID);
AudioManager.instance.PlayWithDelay("MyClip", 0.1f, args);
public AudioSource PlayWithDelayAndGetSource(string clip, float delay, float volume = 1f, float pitch = 1f);
public AudioSource PlayWithDelayAndGetSource(string clip, float delay, AudioMixerGroup mixerGroup, float volume = 1f, float pitch = 1f);
public AudioSource PlayWithDelayAndGetSource(string clip, float delay, int mixerId, float volume = 1f, float pitch = 1f);
public AudioSource PlayWithDelayAndGetSource(string clip, float delay, AudioArgs args);

Returns: AudioSource

Plays the requested clip with optional values for volume and pitch after the entered delay. Also returns the audio source the clip is on for you to check / use as needed. There are several overload methods are also available for audio mixers, either by manual assignment or via the audio manager mixer ID number.

var source = AudioManager.instance.PlayWithDelayAndGetSource("MyClip", 0.1f);
var source = AudioManager.instance.PlayWithDelayAndGetSource("MyClip", 0.1f, mixer);
var source = AudioManager.instance.PlayWithDelayAndGetSource("MyClip", 0.1f, mixerID);
var source = AudioManager.instance.PlayWithDelayAndGetSource("MyClip", 0.1f, args);
public void PlayAtLocation(string clip, Vector3 position, float volume = 1f, float pitch = 1f);
public void PlayAtLocation(string clip, Vector3 position, AudioMixerGroup mixerGroup, float volume = 1f, float pitch = 1f);
public void PlayAtLocation(string clip, Vector3 position, int mixerId, float volume = 1f, float pitch = 1f);
public void PlayAtLocation(string clip, Vector3 position, AudioArgs args);

Plays the requested clip at the position entered with optional values for volume and pitch after the entered delay. There are several overload methods are also available for audio mixers, either by manual assignment or via the audio manager mixer ID number.

Vector3 pos = transform.position;

AudioManager.instance.PlayAtLocation("MyClip", pos);
AudioManager.instance.PlayAtLocation("MyClip", pos, mixer);
AudioManager.instance.PlayAtLocation("MyClip", pos, mixerID);
AudioManager.instance.PlayAtLocation("MyClip", pos, args);
public AudioSource PlayAtLocationAndGetSource(string clip, Vector3 position, float volume = 1f, float pitch = 1f);
public AudioSource PlayAtLocationAndGetSource(string clip, Vector3 position, AudioMixerGroup mixerGroup, float volume = 1f, float pitch = 1f);
public AudioSource PlayAtLocationAndGetSource(string clip, Vector3 position, int mixerId, float volume = 1f, float pitch = 1f);
public AudioSource PlayAtLocationAndGetSource(string clip, Vector3 position, AudioArgs args);

Returns: AudioSource

Plays the requested clip at the position entered with optional values for volume and pitch after the entered delay. Also returns the audio source the clip is on for you to check / use as needed. There are several overload methods are also available for audio mixers, either by manual assignment or via the audio manager mixer ID number.

Vector3 pos = transform.position;

var source = AudioManager.instance.PlayAtLocationAndGetSource("MyClip", pos);
var source = AudioManager.instance.PlayAtLocationAndGetSource("MyClip", pos, mixer);
var source = AudioManager.instance.PlayAtLocationAndGetSource("MyClip", pos, mixerID);
var source = AudioManager.instance.PlayAtLocationAndGetSource("MyClip", pos, args);
public void PlayFromRange(List<string> clips, float delay, float volume = 1f, float pitch = 1f);
public void PlayFromRange(List<string> clips, float delay, AudioMixerGroup mixerGroup, float volume = 1f, float pitch = 1f);
public void PlayFromRange(List<string> clips, float delay, int mixerId, float volume = 1f, float pitch = 1f);
public void PlayFromRange(List<string> clips, float delay, AudioArgs args);
public void PlayFromRange(string[] clips, float delay, float volume = 1f, float pitch = 1f);
public void PlayFromRange(string[] clips, float delay, AudioMixerGroup mixerGroup, float volume = 1f, float pitch = 1f);
public void PlayFromRange(string[] clips, float delay, int mixerId, float volume = 1f, float pitch = 1f);
public void PlayFromRange(string[] clips, float delay, AudioArgs args);

Plays a random clip from the entered strings with optional values for volume and pitch. There are several overload methods are also available for audio mixers, either by manual assignment or via the audio manager mixer ID number.

AudioManager.instance.PlayFromRange(new string[] { "MyClip", "MyOtherClip" });
public AudioSource PlayFromRangeAndGetSource(List<string> clips, float delay, float volume = 1f, float pitch = 1f);
public AudioSource PlayFromRangeAndGetSource(List<string> clips, float delay, AudioMixerGroup mixerGroup, float volume = 1f, float pitch = 1f);
public AudioSource PlayFromRangeAndGetSource(List<string> clips, float delay, int mixerId, float volume = 1f, float pitch = 1f);
public AudioSource PlayFromRangeAndGetSource(List<string> clips, float delay, AudioArgs args);
public AudioSource PlayFromRangeAndGetSource(string[] clips, float delay, float volume = 1f, float pitch = 1f);
public AudioSource PlayFromRangeAndGetSource(string[] clips, float delay, AudioMixerGroup mixerGroup, float volume = 1f, float pitch = 1f);
public AudioSource PlayFromRangeAndGetSource(string[] clips, float delay, int mixerId, float volume = 1f, float pitch = 1f);
public AudioSource PlayFromRangeAndGetSource(string[] clips, float delay, AudioArgs args);

Returns: AudioSource

Plays a random clip from the entered strings and return the audio source the clip is on for you to check / use as needed. There are several overload methods are also available for audio mixers, either by manual assignment or via the audio manager mixer ID number.

var source = AudioManager.instance.PlayFromRangeAndGetSource(new string[] { "MyClip", "MyOtherClip" });
public void PlayRandom(float volume = 1f, float pitch = 1f);
public void PlayRandom(AudioMixerGroup mixerGroup, float volume = 1f, float pitch = 1f);
public void PlayRandom(int mixerId, float volume = 1f, float pitch = 1f);
public void PlayRandom(AudioArgs args);

Plays a random clip from the audio manager library with optional values for volume and pitch. There are several overload methods are also available for audio mixers, either by manual assignment or via the audio manager mixer ID number.

AudioManager.instance.PlayRandom(float volume = 1f, float pitch = 1f);
AudioManager.instance.PlayRandom(AudioMixerGroup mixerGroup, float volume = 1f, float pitch = 1f);
AudioManager.instance.PlayRandom(int mixerId, float volume = 1f, float pitch = 1f);
AudioManager.instance.PlayRandom(AudioArgs args);
public AudioSource PlayRandomAndGetSource(float volume = 1f, float pitch = 1f);
public AudioSource PlayRandomAndGetSource(AudioMixerGroup mixerGroup, float volume = 1f, float pitch = 1f);
public AudioSource PlayRandomAndGetSource(int mixerId, float volume = 1f, float pitch = 1f);
public AudioSource PlayRandomAndGetSource(AudioArgs args);

Returns: AudioSource

Plays a random clip from the audio manager library with optional values for volume and pitch. Also returns the audio source the clip is on for you to check / use as needed. There are several overload methods are also available for audio mixers, either by manual assignment or via the audio manager mixer ID number.

var source = AudioManager.instance.PlayRandomAndGetSource(float volume = 1f, float pitch = 1f);
var source = AudioManager.instance.PlayRandomAndGetSource(AudioMixerGroup mixerGroup, float volume = 1f, float pitch = 1f);
var source = AudioManager.instance.PlayRandomAndGetSource(int mixerId, float volume = 1f, float pitch = 1f);
var source = AudioManager.instance.PlayRandomAndGetSource(AudioArgs args);
public void PlayRandomFromTime(float time, float volume = 1f, float pitch = 1f);
public void PlayRandomFromTime(float time, AudioMixerGroup mixerGroup, float volume = 1f, float pitch = 1f);
public void PlayRandomFromTime(float time, int mixerId, float volume = 1f, float pitch = 1f);
public void PlayRandomFromTime(float time, AudioArgs args);

Plays a random clip from the audio manager library with optional values for volume and pitch from the set time. There are several overload methods are also available for audio mixers, either by manual assignment or via the audio manager mixer ID number.

AudioManager.instance.PlayRandomFromTime(float time, float volume = 1f, float pitch = 1f);
AudioManager.instance.PlayRandomFromTime(float time, AudioMixerGroup mixerGroup, float volume = 1f, float pitch = 1f);
AudioManager.instance.PlayRandomFromTime(float time, int mixerId, float volume = 1f, float pitch = 1f);
AudioManager.instance.PlayRandomFromTime(float time, AudioArgs args);
public AudioSource PlayRandomAndGetSource(float time, float volume = 1f, float pitch = 1f);
public AudioSource PlayRandomAndGetSource(float time, AudioMixerGroup mixerGroup, float volume = 1f, float pitch = 1f);
public AudioSource PlayRandomAndGetSource(float time, int mixerId, float volume = 1f, float pitch = 1f);
public AudioSource PlayRandomAndGetSource(float time, AudioArgs args);

Returns: AudioSource

Plays a random clip from the audio manager library with optional values for volume and pitch from the set time. Also returns the audio source the clip is on for you to check / use as needed. There are several overload methods are also available for audio mixers, either by manual assignment or via the audio manager mixer ID number.

var source = AudioManager.instance.PlayRandomFromTimeAndGetSource(float time, float volume = 1f, float pitch = 1f);
var source = AudioManager.instance.PlayRandomFromTimeAndGetSource(float time, AudioMixerGroup mixerGroup, float volume = 1f, float pitch = 1f);
var source = AudioManager.instance.PlayRandomFromTimeAndGetSource(float time, int mixerId, float volume = 1f, float pitch = 1f);
var source = AudioManager.instance.PlayRandomFromTimeAndGetSource(float time, AudioArgs args);
public void PlayRandomWithDelay(float delay, float volume = 1f, float pitch = 1f);
public void PlayRandomWithDelay(float delay, AudioMixerGroup mixerGroup, float volume = 1f, float pitch = 1f);
public void PlayRandomWithDelay(float delay, int mixerId, float volume = 1f, float pitch = 1f);
public void PlayRandomWithDelay(float delay, AudioArgs args);

Plays a random clip from the audio manager library with optional values for volume and pitch after the entered delay. There are several overload methods are also available for audio mixers, either by manual assignment or via the audio manager mixer ID number.

AudioManager.instance.PlayRandomWithDelay(float delay, float volume = 1f, float pitch = 1f);
AudioManager.instance.PlayRandomWithDelay(float delay, AudioMixerGroup mixerGroup, float volume = 1f, float pitch = 1f);
AudioManager.instance.PlayRandomWithDelay(float delay, int mixerId, float volume = 1f, float pitch = 1f);
AudioManager.instance.PlayRandomWithDelay(float delay, AudioArgs args);
public AudioSource PlayRandomWithDelayAndGetSource(float delay, float volume = 1f, float pitch = 1f);
public AudioSource PlayRandomWithDelayAndGetSource(float delay, AudioMixerGroup mixerGroup, float volume = 1f, float pitch = 1f);
public AudioSource PlayRandomWithDelayAndGetSource(float delay, int mixerId, float volume = 1f, float pitch = 1f);
public AudioSource PlayRandomWithDelayAndGetSource(float delay, AudioArgs args);

Returns: AudioSource

Plays a random clip from the audio manager library with optional values for volume and pitch after the entered delay. Also returns the audio source the clip is on for you to check / use as needed. There are several overload methods are also available for audio mixers, either by manual assignment or via the audio manager mixer ID number.

var source = AudioManager.instance.PlayRandomWithDelayAndGetSource(float delay, float volume = 1f, float pitch = 1f);
var source = AudioManager.instance.PlayRandomWithDelayAndGetSource(float delay, AudioMixerGroup mixerGroup, float volume = 1f, float pitch = 1f);
var source = AudioManager.instance.PlayRandomWithDelayAndGetSource(float delay, int mixerId, float volume = 1f, float pitch = 1f);
var source = AudioManager.instance.PlayRandomWithDelayAndGetSource(float delay, AudioArgs args);