Methods
📌 Summary Table
Playlist()
Playlist
Creates an empty playlist.
Playlist(Track[]
playlistTracks)
Playlist
Creates a playlist from an array of Track
in the given order.
Playlist(string[]
playlistTags)
Playlist
Creates a playlist from an array of tags in the given order.
SetVolume(float
volume)
Playlist
Sets the initial volume of the playlist (0–1).
SetHearDistance(float
minHearDistance, float
maxHearDistance)
Playlist
Defines the minimum and maximum hearing distances.
SetVolumeRolloffCurve(VolumeRolloffCurve
curve)
Playlist
Selects the attenuation curve (logarithmic or linear).
SetCustomVolumeRolloffCurve(AnimationCurve
customCurve)
Playlist
Applies a custom attenuation curve.
ChangeVolume(float
newVolume, float
lerpTime)
void
Changes volume during playback (smooth if lerpTime
> 0).
SetPitch(float
pitch)
Playlist
Sets a fixed pitch for all tracks.
SetDopplerLevel(float
dopplerLevel)
Playlist
Adjusts the Doppler effect intensity (0–5).
SetId(string
id)
Playlist
Assigns a unique identifier to the playlist.
SetLoop(bool
loop)
Playlist
Enables (true
) or disables (false
) infinite looping.
SetPlaylist(Track[]
playlistTracks)
Playlist
Replaces the playlist with the provided Track
array.
SetPlaylist(string[]
playlistTags)
Playlist
Replaces the playlist with the provided tags array.
AddToPlaylist(Track
addedTrack)
void
Adds a Track
to the end of the playlist at runtime.
AddToPlaylist(string
addedTrackTag)
void
Adds a tag to the end of the playlist at runtime.
Shuffle()
void
Shuffles the current tracks and updates playback order.
SetPosition(Vector3
position)
Playlist
Sets the 3D world position from which the audio emits.
SetFollowTarget(Transform
followTarget)
Playlist
Makes the audio source follow the specified Transform
.
SetSpatialSound(bool
activate)
Playlist
Toggles 3D spatial audio (true
) or global 2D (false
).
SetFadeOut(float
fadeOutTime)
Playlist
Defines the fade-out duration at the end of each track or when stopping.
SetFadeIn(float
fadeInTime)
Playlist
Defines the fade-in duration at the start of each track or when starting.
SetOutput(Output
output)
Playlist
Routes audio to a specific AudioMixerGroup
.
OnPlay(Action
onPlay)
Playlist
Callback invoked when the playlist starts.
OnComplete(Action
onComplete)
Playlist
Callback invoked when the playlist ends or is manually stopped.
OnLoopCycleComplete(Action
onLoopCycleComplete)
Playlist
Callback invoked at the end of each loop cycle.
OnNextTrackStart(Action
onNextTrackStart)
Playlist
Callback invoked when the next track begins.
OnPause(Action
onPause)
Playlist
Callback invoked when the playlist is paused.
OnPauseComplete(Action
onPauseComplete)
Playlist
Callback invoked after the pause fade-out completes.
OnResume(Action
onResume)
Playlist
Callback invoked when the playlist resumes after a pause.
Play()
void
Starts playback of the playlist.
Pause(float
fadeOutTime)
void
Pauses the playlist with optional fade-out.
Resume(float
fadeInTime)
void
Resumes the playlist with optional fade-in.
Stop(float
fadeOutTime)
void
Stops the playlist with optional fade-out.
📘 Detailed Description
Playlist
Playlist()
Playlist
Playlist()Creates an empty instance; you must add tracks before playing.
Playlist
Playlist(Track[]
playlistTracks)
Playlist
Playlist(Track[]
playlistTracks)Creates the playlist with the given Track
array in the provided order.
Playlist
Playlist(string[]
playlistTags)
Playlist
Playlist(string[]
playlistTags)Creates the playlist using the specified tags in the provided order.
Playlist
SetVolume(float
volume)
Playlist
SetVolume(float
volume)Sets the initial volume of the playlist, normalized between 0 (mute) and 1 (full volume).
Playlist
SetHearDistance(float
minHearDistance, float
maxHearDistance)
Playlist
SetHearDistance(float
minHearDistance, float
maxHearDistance)Defines the distance at which the audio is fully audible and the distance at which it begins to fade.
Playlist
SetVolumeRolloffCurve(VolumeRolloffCurve
curve)
Playlist
SetVolumeRolloffCurve(VolumeRolloffCurve
curve)Selects a logarithmic or linear attenuation curve for distance-based volume drop-off.
Playlist
SetCustomVolumeRolloffCurve(AnimationCurve
customCurve)
Playlist
SetCustomVolumeRolloffCurve(AnimationCurve
customCurve)Allows you to apply a custom attenuation curve of your choice.
void
ChangeVolume(float
newVolume, float
lerpTime)
void
ChangeVolume(float
newVolume, float
lerpTime)Changes the playlist’s volume during playback; if lerpTime > 0
, the change is smoothed over that duration.
Playlist
SetPitch(float
pitch)
Playlist
SetPitch(float
pitch)Applies a fixed pitch to all tracks in the playlist.
Playlist
SetDopplerLevel(float
dopplerLevel)
Playlist
SetDopplerLevel(float
dopplerLevel)Adjusts Doppler effect intensity (0–5).
Playlist
SetId(string
id)
Playlist
SetId(string
id)Assigns a unique identifier to this instance for management via SoundsGoodManager
without needing a direct reference.
Playlist
SetLoop(bool
loop)
Playlist
SetLoop(bool
loop)Enables infinite looping (true
) or plays through the list once (false
).
Playlist
SetPlaylist(Track[]
playlistTracks)
Playlist
SetPlaylist(Track[]
playlistTracks)Replaces the current playlist with the provided Track
array.
Playlist
SetPlaylist(string[]
playlistTags)
Playlist
SetPlaylist(string[]
playlistTags)Replaces the current playlist with the provided tags array.
void
AddToPlaylist(Track
addedTrack)
void
AddToPlaylist(Track
addedTrack)Dynamically enqueues a Track
to the end of the playlist at runtime.
void
AddToPlaylist(string
addedTrackTag)
void
AddToPlaylist(string
addedTrackTag)Dynamically enqueues a clip by tag to the end of the playlist at runtime.
void
Shuffle()
void
Shuffle()Randomizes the order of the current clips and updates playback if already playing.
Playlist
SetPosition(Vector3
position)
Playlist
SetPosition(Vector3
position)Sets the 3D position from which the playlist audio is emitted.
Playlist
SetFollowTarget(Transform
followTarget)
Playlist
SetFollowTarget(Transform
followTarget)Makes the audio source follow the specified Transform
each frame.
Playlist
SetSpatialSound(bool
activate)
Playlist
SetSpatialSound(bool
activate)Enables (true
) or disables (false
) spatialized 3D audio.
Playlist
SetFadeOut(float
fadeOutTime)
Playlist
SetFadeOut(float
fadeOutTime)Defines the fade-out duration applied at the end of each track or when stopping the playlist.
Playlist
SetFadeIn(float
fadeInTime)
Playlist
SetFadeIn(float
fadeInTime)Defines the fade-in duration applied at the start of each track or when the playlist begins.
Playlist
SetOutput(Output
output)
Playlist
SetOutput(Output
output)Routes the playlist audio to a designated AudioMixerGroup
channel.
Playlist
OnPlay(Action
onPlay)
Playlist
OnPlay(Action
onPlay)Callback invoked when the playlist begins playback.
Playlist
OnComplete(Action
onComplete)
Playlist
OnComplete(Action
onComplete)Callback invoked when the playlist ends naturally or is manually stopped.
Playlist
OnLoopCycleComplete(Action
onLoopCycleComplete)
Playlist
OnLoopCycleComplete(Action
onLoopCycleComplete)Invoked at the end of each loop cycle, if looping is enabled.
Playlist
OnNextTrackStart(Action
onNextTrackStart)
Playlist
OnNextTrackStart(Action
onNextTrackStart)Invoked each time the playlist advances to the next track.
Playlist
OnPause(Action
onPause)
Playlist
OnPause(Action
onPause)Invoked immediately when the playlist is paused.
Playlist
OnPauseComplete(Action
onPauseComplete)
Playlist
OnPauseComplete(Action
onPauseComplete)Invoked after the pause fade-out completes.
Playlist
OnResume(Action
onResume)
Playlist
OnResume(Action
onResume)Invoked when the playlist resumes after a pause.
void
Play()
void
Play()Starts playback of the playlist, applying any configured fade-in.
void
Pause(float
fadeOutTime)
void
Pause(float
fadeOutTime)Pauses playback; if fadeOutTime
is specified, fades out before pausing.
void
Resume(float
fadeInTime)
void
Resume(float
fadeInTime)Resumes playback; if fadeInTime
is specified, fades in over that duration.
void
Stop(float
fadeOutTime)
void
Stop(float
fadeOutTime)Stops playback; if fadeOutTime
is specified, fades out before stopping, otherwise stops immediately.
Last updated