🟧
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
  • πŸ“Œ Summary table
  • πŸ“˜ Detailed description
  • Sound Sound()
  • Sound Sound(SFX sfx)
  • Sound Sound(string tag)
  • Sound SetVolume(float volume)
  • Sound SetHearDistance(float minHearDistance, float maxHearDistance)
  • Sound SetVolumeRolloffCurve(VolumeRolloffCurve curve)
  • Sound SetCustomVolumeRolloffCurve(AnimationCurve customCurve)
  • void ChangeVolume(float newVolume, float lerpTime)
  • Sound SetPitch(float pitch)
  • Sound SetRandomPitch()
  • Sound SetRandomPitch(Vector2 pitchRange)
  • Sound SetDopplerLevel(float dopplerLevel)
  • Sound SetId(string id)
  • Sound SetLoop(bool loop)
  • Sound SetClip(string tag)
  • Sound SetClip(SFX sfx)
  • Sound SetRandomClip(bool random)
  • Sound SetClipByIndex(int index)
  • Sound SetPlayProbability(float probability)
  • Sound SetPosition(Vector3 position)
  • Sound SetFollowTarget(Transform followTarget)
  • Sound SetSpatialSound(bool activate)
  • Sound SetFadeOut(float fadeOutTime)
  • Sound SetOutput(Output output)
  • Sound OnPlay(Action onPlay)
  • Sound OnComplete(Action onComplete)
  • Sound OnLoopCycleComplete(Action onLoopCycleComplete)
  • Sound OnPause(Action onPause)
  • Sound OnPauseComplete(Action onPauseComplete)
  • Sound OnResume(Action onResume)
  • void Play(float fadeInTime)
  • void Pause(float fadeOutTime)
  • void Resume(float fadeInTime)
  • void Stop(float fadeOutTime)
  1. DOCUMENTATION
  2. Audio objects
  3. Sound

Methods

πŸ“Œ Summary table

Method
Type
Short description

Sound()

Sound

Empty constructor.

Sound(SFX)

Sound

Constructor that takes an SFX enum entry.

Sound(string)

Sound

Constructor that takes a registered tag.

SetVolume(float)

Sound

Sets the initial volume (0 – 1).

SetHearDistance(float, float)

Sound

Sets minimum and maximum hearing distances.

SetVolumeRolloffCurve(VolumeRolloffCurve)

Sound

Selects a logarithmic or linear roll-off curve.

SetCustomVolumeRolloffCurve(AnimationCurve)

Sound

Applies a custom roll-off curve.

ChangeVolume(float, float)

void

Changes volume during playback (optional lerp).

SetPitch(float)

Sound

Applies a fixed pitch.

SetRandomPitch()

Sound

Applies a random pitch between 0.85 and 1.15.

SetRandomPitch(Vector2)

Sound

Random pitch inside a custom range.

SetDopplerLevel(float)

Sound

Sets Doppler effect intensity.

SetId(string)

Sound

Assigns a unique ID to the sound.

SetLoop(bool)

Sound

Enables or disables infinite looping.

SetClip(string)

Sound

Assigns a clip by tag.

SetClip(SFX)

Sound

Assigns a clip by SFX enum.

SetRandomClip(bool)

Sound

Enables or disables random clip selection.

SetClipByIndex(int)

Sound

Picks a specific clip by index.

SetPlayProbability(float)

Sound

Probability (0 – 1) that the sound will play when Play() is called.

SetPosition(Vector3)

Sound

Sets the 3-D position of the source.

SetFollowTarget(Transform)

Sound

Makes the source follow a target.

SetSpatialSound(bool)

Sound

Toggles 3-D spatial sound.

SetFadeOut(float)

Sound

Sets fade-out duration.

SetOutput(Output)

Sound

Sends audio to a specific AudioMixerGroup.

OnPlay(Action)

Sound

Callback when playback starts.

OnComplete(Action)

Sound

Callback when playback ends or is stopped.

OnLoopCycleComplete(Action)

Sound

Callback at the end of each loop cycle.

OnPause(Action)

Sound

Callback when the sound is paused.

OnPauseComplete(Action)

Sound

Callback after the pause fade-out finishes.

OnResume(Action)

Sound

Callback when the sound resumes.

Play(float)

void

Plays the sound (optional fade-in).

Pause(float)

void

Pauses with optional fade-out.

Resume(float)

void

Resumes with optional fade-in.

Stop(float)

void

Stops with optional fade-out.


πŸ“˜ Detailed description

Sound Sound()

Empty constructor. You must assign a clip or tag before calling Play().


Sound Sound(SFX sfx)

Builds the sound using the SFX enum generated in Audio Creator.


Sound Sound(string tag)

Builds the sound from the tag you registered in Audio Creator.


Sound SetVolume(float volume)

Sets the initial volume (0 = silent, 1 = max).


Sound SetHearDistance(float minHearDistance, float maxHearDistance)

Defines the distance at which the sound is fully audible and the distance at which it starts fading in.


Sound SetVolumeRolloffCurve(VolumeRolloffCurve curve)

Selects the Logarithmic or Linear roll-off curve for distance attenuation.


Sound SetCustomVolumeRolloffCurve(AnimationCurve customCurve)

Lets you apply an AnimationCurve you created for custom attenuation.


void ChangeVolume(float newVolume, float lerpTime)

Changes the volume while the sound is playing. If lerpTime > 0 the change is smoothed.


Sound SetPitch(float pitch)

Sets a fixed pitch (also affects playback speed).


Sound SetRandomPitch()

Automatically applies a random pitch between 0.85 and 1.15.


Sound SetRandomPitch(Vector2 pitchRange)

Applies random pitch inside the custom range you pass.


Sound SetDopplerLevel(float dopplerLevel)

Defines Doppler intensity (0 – 5).


Sound SetId(string id)

Assigns a unique ID so you can control the sound via SoundsGoodManager without a direct reference.


Sound SetLoop(bool loop)

true β†’ infinite looping, false β†’ plays once.


Sound SetClip(string tag)

Assigns a clip using its tag from Audio Creator.


Sound SetClip(SFX sfx)

Assigns a clip using the SFX enum.


Sound SetRandomClip(bool random)

If enabled, a random clip is chosen each time you call Play().


Sound SetClipByIndex(int index)

Plays a specific clip by its index inside the tag’s clip array.


Sound SetPlayProbability(float probability)

Sets the chance (0 – 1) that the sound will actually play when Play() is invoked.


Sound SetPosition(Vector3 position)

Sets the world position of the audio source.


Sound SetFollowTarget(Transform followTarget)

Makes the audio source follow the given Transform every frame.


Sound SetSpatialSound(bool activate)

true β†’ 3-D spatial sound; false β†’ global (2-D) sound.


Sound SetFadeOut(float fadeOutTime)

Duration of the fade-out when the clip ends or is stopped.


Sound SetOutput(Output output)

Routes the sound to a specific channel managed by an Audio Mixer.


Sound OnPlay(Action onPlay)

Callback fired when playback starts.


Sound OnComplete(Action onComplete)

Callback fired when playback finishes naturally or is stopped manually.


Sound OnLoopCycleComplete(Action onLoopCycleComplete)

Executed each time a loop cycle finishes, if loop is enabled.


Sound OnPause(Action onPause)

Immediate callback when the sound is paused.


Sound OnPauseComplete(Action onPauseComplete)

Fires after the pause fade-out completes.


Sound OnResume(Action onResume)

Callback fired when the sound resumes after being paused.


void Play(float fadeInTime)

Plays the sound. If fadeInTime > 0, applies a fade-in.


void Pause(float fadeOutTime)

Pauses the sound. If fadeOutTime > 0, fades out before pausing.


void Resume(float fadeInTime)

Resumes playback, applying a fade-in if specified.


void Stop(float fadeOutTime)

Stops the sound. If fadeOutTime > 0, performs a fade-out; if 0, stops immediately.


PreviousPropertiesNextMusic

Last updated 17 days ago