bool Repeat { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The Repeat property of the BaseSoundComponent class determines whether the sound should loop continuously when played. If set to true, the sound will automatically restart from the beginning once it reaches the end, creating a seamless loop. This is useful for background music or ambient sounds that need to play indefinitely.

Usage

To use the Repeat property, simply set it to true or false depending on whether you want the sound to loop:

BaseSoundComponent soundComponent = new BaseSoundComponent();
soundComponent.Repeat = true; // Enable looping

Ensure that the sound component is properly initialized and added to a scene or game object before attempting to play the sound.

Example

BaseSoundComponent soundComponent = new BaseSoundComponent();
soundComponent.Repeat = true;
soundComponent.StartSound(); // This will start the sound and it will loop indefinitely.