Description
The PlayOnStart
property of the BaseSoundComponent
class determines whether the sound should automatically start playing when the component is initialized. This property is a boolean value, where true
indicates that the sound will play on start, and false
means it will not.
Usage
To use the PlayOnStart
property, simply set it to true
or false
depending on whether you want the sound to play automatically when the component is initialized. This can be useful for ambient sounds or background music that should start playing as soon as the scene or game object is loaded.
Example
// Example of setting the PlayOnStart property
// Create an instance of BaseSoundComponent
BaseSoundComponent soundComponent = new BaseSoundComponent();
// Set PlayOnStart to true to play the sound when the component starts
soundComponent.PlayOnStart = true;
// Alternatively, set PlayOnStart to false if you want to control when the sound starts manually
soundComponent.PlayOnStart = false;