
Scripting
Namespace
All code for this asset is under the following namespace(s):
// General Code
CarterGames.Assets.AudioManager
// Editor Code (Custom Inspectors)
CarterGames.Assets.AudioManager.Editor
Scripting
Classes
Audio Manager
Properties
CanPlayAudio
Toggles whether or not the manager can play audio. This doesn’t effect other Audio Manager instances or the other player scripts.
Returns
bool
GetNumberOfClips
Gets the number of clips currently in this instance of the Audio Manager.
Returns
int
GetAudioManagerFile
Gets the current AMF in use.
Returns
AudioManagerFile
GetRandomSound
Picks a random sound from the current AMF and returns it.
Returns
AudioClip
Audio Manager
Methods
HasClip()
Checks to see if a clip exists in the audio manager library.
Returns
bool
IsClipPlaying()
Checks to see if the clip in question is playing.
Returns
bool
Play()
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.
Overloads
Play(string request, float volume = 1f, float pitch = 1f)
Play(string request, AudioMixerGroup mixer, float Volume = 1f, float pitch = 1f)
Play(string request, int mixerID, float volume = 1f, float pitch = 1f)
Play(string request, AudioArgs args)
PlayAndGetSource()
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.
Returns
AudioSource
Overloads
PlayAndGetSource(string request, float volume = 1, float pitch = 1)
PlayAndGetSource(string request, AudioMixerGroup mixer, float volume = 1, float pitch = 1)
PlayAndGetSource(string request, int mixerID, float volume = 1, float pitch = 1)
PlayAndGetSource(string request, AudioArgs args)
PlayFromTime()
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.
Overloads
PlayFromTime(string request, float time, float volume = 1f, float pitch = 1f)
PlayFromTime(string request, float time, AudioMixerGroup mixer, float volume = 1f, float pitch = 1f)
PlayFromTime(string request, float time, int mixerID, float volume = 1f, float pitch = 1f)
PlayFromTime(string request, float time, AudioArgs args)
PlayFromTimeAndGetSource()
Play a sound from a particular time code on the audio clip audioManagerFile and 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.
Returns
AudioSource
Overloads
PlayFromTimeAndGetSource(string request, float time, float volume = 1, float pitch = 1)
PlayFromTimeAndGetSource(string request, AudioMixerGroup mixer, float time, float volume = 1, float pitch = 1)
PlayFromTimeAndGetSource(string request, int mixerID, float time, float volume = 1, float pitch = 1)
PlayFromTimeAndGetSource(string request, float time, AudioArgs args)
PlayWithDelay()
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.
Overloads
PlayWithDelay(string request, float delay, float volume = 1f, float pitch = 1f)
PlayWithDelay(string request, float delay, AudioMixerGroup mixer, float Volume = 1f, float pitch = 1f)
PlayWithDelay(string request, float delay, int mixerID, float volume = 1f, float pitch = 1f)
PlayWithDelay(string request, float delay, AudioArgs args)
PlayWithDelayAndGetSource()
Play a sound from a particular time code on the audio clip audioManagerFile and 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.
Returns
AudioSource
Overloads
PlayWithDelayAndGetSource(string request, float delay, float volume = 1f, float pitch = 1f)
PlayWithDelayAndGetSource(string request, AudioMixerGroup mixer,float delay, float volume = 1f, float pitch = 1f)
PlayWithDelayAndGetSource(string request, int mixerID, float delay, float volume = 1f, float pitch = 1f)
PlayWithDelayAndGetSource(string request, float delay, AudioArgs args)
PlayFromRange()
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.
Overloads
PlayFromRange(List<string> or string[] request, float volume = 1f, float pitch = 1f)
PlayFromRange(List<string> or string[] request, AudioMixerGroup mixer, float volume = 1f, float pitch = 1f)
PlayFromRange(List<string> or string[] request, int mixerID, float volume = 1f, float pitch = 1f)
PlayFromRange(List<string> or string[] request, AudioArgs args)
PlayFromRangeAndGetSource()
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.
Returns
AudioSource
Overloads
PlayFromRangeAndGetSource(List<string> or string[] request, float volume = 1, float pitch = 1)
PlayFromRangeAndGetSource(List<string> or string[] request, AudioMixerGroup mixer, float volume = 1, float pitch = 1)
PlayFromRangeAndGetSource(List<string> or string[] request, int mixerID, float volume = 1, float pitch = 1)
PlayFromRangeAndGetSource(List<string> or string[] request, AudioArgs args)
PlayFromRangeFromTime()
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.
Overloads
PlayFromRangeFromTime(List<string> or string[] request, float volume = 1f, float pitch = 1f)
PlayFromRangeFromTime(List<string> or string[] request, AudioMixerGroup mixer, float volume = 1f, float pitch = 1f)
PlayFromRangeFromTime(List<string> or string[] request, int mixerID, float volume = 1f, float pitch = 1f)
PlayFromRangeFromTime(List<string> or string[] request, AudioArgs args)
PlayFromRangeFromTimeAndGetSource()
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.
Returns
AudioSource
Overloads
PlayFromRangeFromTimeAndGetSource(List<string> or string[] request, float time, float volume = 1, float pitch = 1)
PlayFromRangeFromTimeAndGetSource(List<string> or string[] request, float time, AudioMixerGroup mixer, float volume = 1, float pitch = 1)
PlayFromRangeFromTimeAndGetSource(List<string> or string[] request, float time, int mixerID, float volume = 1, float pitch = 1)
PlayFromRangeFromTimeAndGetSource(List<string> or string[] request, float time, AudioArgs args)
PlayFromRangeWithDelay()
Plays a random clip from the entered strings with the requested delay before playing the clip. There are several overload methods are also available for audio mixers, either by manual assignment or via the audio manager mixer ID number.
Overloads
PlayFromRangeWithDelay(string request, float delay, float volume = 1f, float pitch = 1f)
PlayFromRangeWithDelay(string request, float delay, AudioMixerGroup mixer, float Volume = 1f, float pitch = 1f)
PlayFromRangeWithDelay(string request, float delay, int mixerID, float volume = 1f, float pitch = 1f)
PlayFromRangeWithDelay(string request, float delay, AudioArgs args)
PlayFromRangeWithDelayAndGetSource()
Plays a random clip from the entered strings with the requested delay before playing as well as returning 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.
Returns
AudioSource
Overloads
PlayFromRangeWithDelayAndGetSource(string request, float delay, float volume = 1f, float pitch = 1f)
PlayFromRangeWithDelayAndGetSource(string request, AudioMixerGroup mixer,float delay, float volume = 1f, float pitch = 1f)
PlayFromRangeWithDelayAndGetSource(string request, int mixerID, float delay, float volume = 1f, float pitch = 1f)
PlayFromRangeWithDelayAndGetSource(string request, float delay, AudioArgs args)
PlayRandom()
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.
Overloads
PlayRandom(float volume = 1f, float pitch = 1f)
PlayRandom(AudioMixerGroup mixer, float volume = 1f, float pitch = 1f)
PlayRandom(int mixerID, float volume = 1f, float pitch = 1f)
PlayRandom(AudioArgs args)
PlayRandomAndGetSource()
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.
Returns
AudioSource
Overloads
PlayRandomAndGetSource(float volume = 1f, float pitch = 1f)
PlayRandomAndGetSource(AudioMixerGroup mixer, float volume = 1f, float pitch = 1f)
PlayRandomAndGetSource(int mixerID, float volume = 1f, float pitch = 1f)
PlayRandomAndGetSource(AudioArgs args)
PlayRandomFromTime()
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.
Overloads
PlayRandomFromTime(float time, float volume = 1f, float pitch = 1f)
PlayRandomFromTime(float time, AudioMixerGroup mixer, float volume = 1f, float pitch = 1f)
PlayRandomFromTime(float time, int mixerID, float volume = 1f, float pitch = 1f)
PlayRandomFromTime(float time, AudioArgs args)
PlayRandomFromTimeAndGetSource()
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.
Returns
AudioSource
Overloads
PlayRandomFromTimeAndGetSource(float time, float volume = 1f, float pitch = 1f)
PlayRandomFromTimeAndGetSource(float time, AudioMixerGroup mixer, float volume = 1f, float pitch = 1f)
PlayRandomFromTimeAndGetSource(float time, int mixerID, float volume = 1f, float pitch = 1f)
PlayRandomFromTimeAndGetSource(float time, AudioArgs args)
PlayRandomWithDelay()
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.
Overloads
PlayRandomWithDelay(float delay, float volume = 1f, float pitch = 1f)
PlayRandomWithDelay(float delay, AudioMixerGroup mixer, float volume = 1f, float pitch = 1f)
PlayRandomWithDelay(float delay, int mixerID, float volume = 1f, float pitch = 1f)
PlayRandomWithDelay(float delay, AudioArgs args)
PlayRandomWithDelayAndGetSource()
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.
Returns
AudioSource
Overloads
PlayRandomWithDelayAndGetSource(float delay, float volume = 1f, float pitch = 1f)
PlayRandomWithDelayAndGetSource(float delay, AudioMixerGroup mixer, float volume = 1f, float pitch = 1f)
PlayRandomWithDelayAndGetSource(float delay, int mixerID, float volume = 1f, float pitch = 1f)
PlayRandomWithDelayAndGetSource(float delay, AudioArgs args)
Audio Player
Methods
Play()
Plays all the clips assigned in the inspector. This uses the settings from the inspector for the clip to set the values for it. You can edit the volume, pitch, start time & delay from the custom inspector for each clip in the player.
Music Player
Actions
All actions are public and static, they can be accessed like so:
MusicPlayer.OnTrackStarted
OnTrackStarted
Triggered whenever a new track is started on a track loops around to the start again.
OnTrackEnded
Triggered whenever the track has ended.
OnTrackLooped
Triggered whenever a track loops around back to the start.
OnTrackChanged
Triggered whenever the user changes the active track.
OnTrackTransitionComplete
Triggered whenever the active track transition has completed
Music Player
Properties
IsTrackPlaying
Gets whether or not there is a track currently playing?
Returns
bool
GetActiveTrack
Gets the track that is currently being player by the music player script.
Returns
AudioClip
GetTrackPosition
Gets the current time in seconds that the track is at.
Returns
float
GetActiveSource
Gets the audio source component that is playing the active track.
Returns
AudioSource
ShouldLoop
Gets/Sets whether or not the active track should loop.
Returns
bool
Music Player
Methods
SetVolume()
Sets the volume of the music player to the entered value. Range is between 0-1.
SetVolume(float value)
StopTrack()
Stops the active track from playing without any transition.
PlayTrack()
Plays the track requested on the music player script. There are several overloads for this method that allow for additional options. If just using the audioclip param the transition will stay as the last one used in the inspector, the start time will be set to 0 and the end time will be set to the track length.
PlayTrack(AudioClip track)
PlayTrack(AudioClip track, TransitionType transitionType)
PlayTrack(AudioClip track, TransitionType transitionType, float transitionDuration)
PlayTrack(AudioClip track, float startTime)
PlayTrack(AudioClip track, float startTime, TransitionType transitionType)
PlayTrack(AudioClip track, float startTime, TransitionType transitionType, float transitionDuration)
PlayTrack(AudioClip track, float startTime, float endTime)
PlayTrack(AudioClip track, float startTime, float endTime, TransitionType transitionType)
PlayTrack(AudioClip track, float startTime, float endTime, TransitionType transitionType, float transitionDuration)
Audio Events
Actions
OnClipStart
Triggered when any clip has started playing.
OnClipEnd
Triggered when any clip has finished playing.