๐ŸŸง
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
  • ๐Ÿ› ๏ธ Set prefix
  • ๐Ÿ”” On prefix
  1. DOCUMENTATION

Prefixes

The Sounds Good API follows a clear semantic convention so you can read the code almost like a sentence:

Prefix
Meaning
Returns
Chainable

Set

Configures or assigns a value before / during playback.

The same instance (this).

โœ”๏ธ

On

Declares a callback that fires on a lifecycle event.

The same instance (this).

โœ”๏ธ

Methods without prefix (Play, Pause, Stop, Resume)

Immediate action on the audio.

void

โŒ


๐Ÿ› ๏ธ Set prefix

Every function that starts with Set stores parameters on the object and returns it so you can keep chaining:

new Sound(SFX.Explosion)
    .SetVolume(0.55f)
    .SetRandomPitch()           // variation to avoid repetition
    .SetSpatialSound(true)      // 3D
    .SetFadeOut(0.8f)           // fade when it ends
    .Play();

๐Ÿ’ก Create first, set afterwards, finish with play.


๐Ÿ”” On prefix

Onโ€ฆ methods let you subscribe to events without coroutines or repetitive Invokes:

var loopingMusic = new Music(Track.ForestAmbience)
    .SetLoop(true)
    .OnPlay(()      => Debug.Log("Ambient started"))
    .OnPause(()     => Debug.Log("Ambient paused"))
    .OnResume(()    => Debug.Log("Ambient resumed"))
    .OnComplete(()  => Debug.Log("Ambient stopped"));

loopingMusic.Play();    // fires OnPlay

// Laterโ€ฆ
loopingMusic.Pause();   // fires OnPause
loopingMusic.Resume();  // fires OnResume
loopingMusic.Stop();    // fires OnComplete
PreviousAssemblies and NamespacesNextAudio objects

Last updated 17 days ago