void StopAllSounds( float fadeOutTime )

book_4_sparkGenerated
code_blocksInput

Description

The StopAllSounds method stops any sounds currently playing on the GameObject. This method allows you to specify a fade-out time, which is the duration over which the sounds will gradually decrease in volume until they are completely stopped. This can be useful for creating smooth audio transitions.

Usage

To use the StopAllSounds method, call it on an instance of a GameObject and provide a float value for the fadeOutTime parameter. This value determines how long it will take for the sounds to fade out completely.

Example

// Example of stopping all sounds on a GameObject with a fade-out time of 2 seconds.
GameObject myGameObject = new GameObject();
myGameObject.StopAllSounds(2.0f);