void StopAllSounds( float fadeOutTime )

robot_2Generated
code_blocksInput

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 fadeOutTime parameter. The fadeOutTime is a float value representing the duration in seconds over which the sounds will fade out.

For example, if you want to stop all sounds immediately, you can pass 0 as the fadeOutTime. If you want the sounds to fade out over 2 seconds, pass 2.0f.

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);