Description
The DistanceAttenuation
property of the BaseSoundComponent
class determines whether the sound's volume is affected by the distance between the sound source and the listener. When set to true
, the sound will decrease in volume as the distance increases, simulating a more realistic audio experience.
Usage
To use the DistanceAttenuation
property, you can set it directly on an instance of a class that inherits from BaseSoundComponent
. This property is useful when you want to control whether a sound should have distance-based volume attenuation.
Example
// Example of setting the DistanceAttenuation property
var soundComponent = new MySoundComponent();
soundComponent.DistanceAttenuation = true; // Enable distance attenuation
// Later in the code, you might want to disable it
soundComponent.DistanceAttenuation = false; // Disable distance attenuation