Description
The StopOnNew
property of the BaseSoundComponent
class determines whether the currently playing sound should be stopped when a new sound is triggered. This is useful in scenarios where overlapping sounds are undesirable, and you want to ensure that only one instance of a sound is playing at any given time.
Usage
To use the StopOnNew
property, simply set it to true
or false
depending on whether you want the current sound to stop when a new sound is played. This property is part of the BaseSoundComponent
class, which is typically used in audio management within a scene.
Example
// Example of using the StopOnNew property
// Create an instance of BaseSoundComponent
BaseSoundComponent soundComponent = new BaseSoundComponent();
// Set StopOnNew to true to stop the current sound when a new one is played
soundComponent.StopOnNew = true;
// Alternatively, set it to false to allow overlapping sounds
soundComponent.StopOnNew = false;