🟧
Sounds Good Documentation
English
English
  • Welcome!
  • FIRSTS STEPS
    • Create your first sound
  • Create and use audio outputs
  • Included Prefabs
  • Update from 1.0 to 2.0
  • DOCUMENTATION
    • Assemblies and Namespaces
    • Prefixes
    • Audio objects
      • Sound
        • Properties
        • Methods
      • Music
        • Properties
        • Methods
      • Playlist
        • Properties
        • Methods
      • DynamicMusic
        • Properties
        • Methods
    • Editor windows
      • Audio Creator
      • Audio Collection
      • Output Manager
    • SoundsGoodManager
  • Extras
    • Credits
    • Acknowledgments
Powered by GitBook
On this page
  • 🛠️ How to create a Playlist
  • 📝 Advanced Example
  1. DOCUMENTATION
  2. Audio objects

Playlist

A Playlist is an instance that plays a sequence of music tracks in order, one after another. It’s ideal for ambient radio-style music or any scenario where you want continuous, automatic track changes. Use the music tracks you’ve already created in the Audio Creator window under the Music tab.


🛠️ How to create a Playlist

Group your previously created tracks by their tags or by the Track enum. For example, to set up a radio with three songs:

new Playlist("RockSong", "JazzSong", "ElectronicSong").Play();

Or using the Track identifiers directly:

new Playlist(Track.RockSong, Track.JazzSong, Track.ElectronicSong).Play();

If you rename a track’s tag in the Audio Collection window, any code references will break.

Playlist radio = new Playlist(Track.RockSong, Track.JazzSong)
    .SetLoop(true)    // Repeat the sequence when it ends
    .SetFadeOut(1f);  // 1-second fade-out at the end of each track
radio.Play();

📝 Advanced Example

Playlist ambientRadio = new Playlist(Track.ForestTheme, Track.RainTheme, Track.CityTheme)
    .SetVolume(0.6f)
    .SetLoop(true)
    .SetFollowTarget(carTransform)     // Music follows the car
    .Shuffle()                         // Randomize track order
    .SetOutput(Output.Music)           // Route to the Music channel
    .SetFadeIn(2f)                     // 2-second fade-in at the start of each track
    .SetFadeOut(2f)                    // 2-second fade-out at the end of each track
    .OnNextTrackStart(() => Debug.Log("Track changed!"))
    .Play();

👉 Configures an “ambient radio” that shuffles tracks with smooth transitions and logs a message whenever the next song starts.

PreviousMethodsNextProperties

Last updated 17 days ago