RangedFloat Volume { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The Volume property of the SoundEvent class specifies how loud the sound should be. It is represented as a RangedFloat, allowing for a range of values to be set, which can be useful for randomizing sound volume within a specified range.

Usage

To set the volume of a sound event, assign a value to the Volume property. The value should be within the range of 0 to 1, where 0 is completely silent and 1 is the maximum volume. The property supports a step of 0.01, allowing for fine adjustments.

Example

// Example of setting the Volume property for a SoundEvent
SoundEvent mySoundEvent = new SoundEvent();
mySoundEvent.Volume = new RangedFloat(0.5f, 0.8f); // Sets the volume to a random value between 0.5 and 0.8