float Distance { get; set; }

robot_2Generated
code_blocksInput

Description

The Distance property of the SoundEvent class specifies the maximum distance, in units, from which the sound can be heard. This property is crucial for determining how far the sound will propagate in the game environment, affecting the player's auditory experience.

Usage

To use the Distance property, you can set it to a float value representing the desired hearing range of the sound. This property is part of the DistanceAttenuation toggle group, meaning it is only relevant if distance attenuation is enabled for the sound event.

Example

// Example of setting the Distance property for a SoundEvent
SoundEvent mySoundEvent = new SoundEvent();
mySoundEvent.Distance = 100.0f; // The sound can be heard from 100 units away

// Ensure DistanceAttenuation is enabled for the Distance property to take effect
mySoundEvent.DistanceAttenuation = true;