Sandbox.SoundEvent/SoundSelectionMode SelectionMode { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The SelectionMode property of the SoundEvent class specifies the strategy used to select a sound from a list of available sounds. This property is of type SoundSelectionMode, which defines the different modes of selection that can be applied when multiple sounds are available for playback.

Usage

To use the SelectionMode property, you need to set it to one of the values defined in the SoundSelectionMode enumeration. This will determine how the sound is selected from the list of sounds associated with the SoundEvent. For example, you might choose a random selection mode to play a different sound each time, or a sequential mode to play sounds in order.

Example

// Example of setting the SelectionMode property
SoundEvent mySoundEvent = new SoundEvent();
mySoundEvent.SelectionMode = SoundSelectionMode.Random; // Set the selection mode to random

// Add sounds to the SoundEvent
mySoundEvent.Sounds.Add(new SoundFile("sound1.wav"));
mySoundEvent.Sounds.Add(new SoundFile("sound2.wav"));

// Play the sound event
mySoundEvent.Play();