pub struct AudioSource {Show 25 fields
pub BypassEffects: bool,
pub DopplerLevel: f32,
pub Loop: bool,
pub MaxDistance: f32,
pub MinDistance: f32,
pub Mute: bool,
pub Pan2D: f32,
pub Priority: i32,
pub m_Enabled: u8,
pub m_GameObject: PPtr,
pub m_Pitch: f32,
pub m_PlayOnAwake: bool,
pub m_Volume: f32,
pub m_audioClip: PPtr,
pub panLevelCustomCurve: AnimationCurve,
pub rolloffCustomCurve: AnimationCurve,
pub rolloffMode: i32,
pub spreadCustomCurve: AnimationCurve,
pub BypassListenerEffects: Option<bool>,
pub BypassReverbZones: Option<bool>,
pub OutputAudioMixerGroup: Option<PPtr>,
pub Spatialize: Option<bool>,
pub SpatializePostEffects: Option<bool>,
pub m_ExtensionPropertyValues: Option<Vec<ExtensionPropertyValue>>,
pub reverbZoneMixCustomCurve: Option<AnimationCurve>,
}Expand description
AudioSource is a class of the Unity engine since version 3.4.0. Exert from Unity’s scripting documentation: A representation of audio sources in 3D. An AudioSource is attached to a GameObject for playing back sounds in a 3D environment.
In order to play 3D sounds you also need to have a AudioListener.
The audio listener is normally attached to the camera you want to use.
Whether sounds are played in 3D or 2D is determined by AudioImporter settings.You can play a single audio clip using Play, Pause and Stop.
You can also adjust its volume while playing using the volume property, or seek using time.
Multiple sounds can be played on one AudioSource using PlayOneShot.
You can play a clip at a static position in 3D space using PlayClipAtPoint.See Also: AudioListener, AudioClip, AudioSource component.
Fields§
§BypassEffects: boolBypass effects (Applied from filter components or global listener filters).
DopplerLevel: f32Sets the Doppler scale for this AudioSource.
Loop: boolIs the audio clip looping?
MaxDistance: f32(Logarithmic rolloff) MaxDistance is the distance a sound stops attenuating at.
MinDistance: f32Within the Min distance the AudioSource will cease to grow louder in volume.
Mute: boolUn- / Mutes the AudioSource. Mute sets the volume=0, Un-Mute restore the original volume.
Pan2D: f32§Priority: i32Sets the priority of the AudioSource.
m_Enabled: u8Enabled Behaviours are Updated, disabled Behaviours are not.
m_GameObject: PPtrThe game object this component is attached to. A component is always attached to a game object.
PPtr<GameObject>: (3.4.0 - 2022.3.2f1)
m_Pitch: f32The pitch of the audio source.
m_PlayOnAwake: boolIf set to true, the audio source will automatically start playing on awake.
m_Volume: f32The volume of the audio source (0.0 to 1.0).
m_audioClip: PPtrPPtr<AudioClip>: (3.4.0 - 2022.3.2f1)
panLevelCustomCurve: AnimationCurve§rolloffCustomCurve: AnimationCurve§rolloffMode: i32Sets/Gets how the AudioSource attenuates over distance.
spreadCustomCurve: AnimationCurve§BypassListenerEffects: Option<bool>When set global effects on the AudioListener will not be applied to the audio signal generated by the AudioSource. Does not apply if the AudioSource is playing into a mixer group. bool: (4.2.0 - 2022.3.2f1)
BypassReverbZones: Option<bool>When set doesn’t route the signal from an AudioSource into the global reverb associated with reverb zones. bool: (4.2.0 - 2022.3.2f1)
OutputAudioMixerGroup: Option<PPtr>The target group to which the AudioSource should route its signal.
PPtr<AudioMixerGroup>: (5.0.0f4 - 2022.3.2f1)
Spatialize: Option<bool>Enables or disables spatialization. bool: (5.2.0f2 - 2022.3.2f1)
SpatializePostEffects: Option<bool>Determines if the spatializer effect is inserted before or after the effect filters. bool: (5.5.0f3 - 2022.3.2f1)
m_ExtensionPropertyValues: Option<Vec<ExtensionPropertyValue>>Vec
reverbZoneMixCustomCurve: Option<AnimationCurve>AnimationCurve: (5.0.0f4 - 2022.3.2f1)