Description
The StopAllSounds
method is used to stop all sounds currently playing on a 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 represents the time in seconds over which the sounds will fade out.
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);