Skip to content

AudioSource

extends Component

The AudioSource class is used to play audio on a game object.

成员变量

AudioSource.time : number
The current playback time (in seconds) of the audio being played by the AudioSource component.
AudioSource.timeSamples : number
The current sample position of the audio being played.
AudioSource.isPlaying : boolean
(Read Only) Whether the audio clip is currently playing.
AudioSource.pitch : number
The pitch of the audio source.
AudioSource.clip : AudioClip
The default audio clip to play.
AudioSource.priority : number
The priority of audio playback.
AudioSource.loop : boolean
Whether the current audio is played in a loop.
AudioSource.isVirtual : boolean
Whether the current audio is virtual.
AudioSource.rolloffMode : AudioRolloffMode
The sound attenuation mode of the audio source.
AudioSource.playOnAwake : boolean
Whether to automatically play audio when the game object is awakened.
AudioSource.mute : boolean
Whether the audio is currently muted.
AudioSource.panStereo : number
Stereo balance of the audio source.
AudioSource.rolloffCurve : Vector2[]
The volume attenuation curve of the audio source.
AudioSource.volume : number
The volume of the audio.
AudioSource.spatialBlend : number
Spatial blend of the audio source.
AudioSource.minDistance : number
The minimum propagation distance of the audio source.
AudioSource.maxDistance : number
The maximum distance at which the audio source can be heard.
AudioSource.dopplerLevel : number
The level of Doppler effect for the audio source.
AudioSource.spread : number
The spread of audio in a stereo environment.
AudioSource.playState : AudioPlayState
Audio playback state.

成员方法

AudioSource.Play ( ) : void
Plays the audio clip associated with the audio source.
AudioSource.Pause ( paused : boolean ) : void
Pauses the audio playback.
AudioSource.Stop ( ) : void
Stops the currently playing audio clip of the audio source.