Description
The UI
property of the SoundEvent
class indicates whether the sound is a 2D sound, typically used for user interface (UI) elements. When set to true
, the sound is played as a 2D sound, meaning it is not affected by the 3D spatial environment and is heard equally from all directions, making it ideal for UI sounds.
Usage
To use the UI
property, simply set it to true
if you want the sound to be played as a 2D sound. This is useful for sounds that should not be affected by the player's position or orientation, such as button clicks or notifications.
Example
// Example of setting the UI property for a SoundEvent
SoundEvent mySoundEvent = new SoundEvent();
mySoundEvent.UI = true; // This sound will be played as a 2D sound, suitable for UI elements.