Description
The StopAllSounds
method stops all sounds currently playing on the GameObject
. This method allows you to specify a fade-out time, which will gradually reduce the volume of the sounds to zero over the specified duration before stopping them completely.
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 before stopping.
Example
// Example of stopping all sounds on a GameObject with a fade-out time
GameObject myGameObject = new GameObject();
// Stop all sounds with a fade-out time of 2 seconds
myGameObject.StopAllSounds(2.0f);