AudioSource
Class, inherits from Behaviour
A representation of audio sources in 3D.
An AudioSource is attached to a GameObject for playing back sounds in a 3D environment.
Mono sounds play back 3D. 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.
Stereo sounds are always played back without distance based attenuation.
You can play a single audio clip using Play, Pause and Stop. You can also adjust its volume while playing using 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.
Variables
| volume |
The volume of the audio source.
|
| pitch |
The pitch of the audio source.
|
| time |
Playback position in seconds.
|
| clip |
The default AudioClip to play
|
| isPlaying |
Is the clip playing right now (Read Only)?
|
| loop |
Is the audio clip looping?
|
| ignoreListenerVolume |
This makes the audio source not take into account the volume of the audio listener.
|
| playOnAwake |
If set to true, the audio source will automatically start playing on awake
|
| minVolume |
The minimal volume the audio source will play at.
|
| maxVolume |
The maximum volume the audio source will play at.
|
| rolloffFactor |
How fast the sound fades.
|
| velocityUpdateMode |
Whether the Audio Source should be updated in the fixed or dynamic update.
|
Functions
Class Functions
| PlayClipAtPoint |
Plays the clip at position. Automatically cleans up the audio source after it has finished playing.
|
Inherited members
Inherited Variables
Inherited Functions
Inherited Class Functions
|
operator bool |
Does the object exist?
|
|
Instantiate |
Clones the object original and returns the clone.
|
|
Destroy |
Removes a gameobject, component or asset.
|
|
DestroyImmediate |
Destroys the object obj immediately. It is strongly recommended to use Destroy instead.
|
|
FindObjectsOfType |
Returns a list of all active loaded objects of Type type.
|
|
FindObjectOfType |
Returns the first active loaded object of Type type.
|
|
operator == |
Compares if two objects refer to the same
|
|
operator != |
Compares if two objects refer to a different object
|
|
DontDestroyOnLoad |
Makes the object target not be destroyed automatically when loading a new scene.
|
|