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.
The volume of the audio source (0.0 to 1.0).
The pitch of the audio source.
Playback position in seconds.
Playback position in PCM samples.
The default AudioClip to play.
Is the clip playing right now (Read Only)?
Is the audio clip looping?
This makes the audio source not take into account the volume of the audio listener.
If set to true, the audio source will automatically start playing on awake.
Allows AudioSource to play even though AudioListener.pause is set to true. This is useful for the menu element sounds or background music in pause menus.
Whether the Audio Source should be updated in the fixed or dynamic update.
Sets how much the 3d engine has an effect on the channel.
Bypass effects (Applied from filter components or global listener filters).
Sets the Doppler scale for this AudioSource.
Sets the spread angle a 3d stereo or multichannel sound in speaker space.
Sets the priority of the AudioSource.
Un- / Mutes the AudioSource. Mute sets the volume=0, Un-Mute restore the original volume.
Within the Min distance the AudioSource will cease to grow louder in volume.
(Logarithmic rolloff) MaxDistance is the distance a sound stops attenuating at.
Sets a channels pan position linearly. Only works for 2D clips.
Sets/Gets how the AudioSource attenuates over distance.
Plays the clip with an optional certain delay. The delay parameter is deprecated, please use the newer PlayDelayed function instead which specifies the delay in seconds.
Plays the clip with a delay specified in seconds. Users are advised to use this function instead of the old Play(delay) function that took a delay specified in samples relative to a reference rate of 44.1 kHz as an argument.
Plays the clip at a specific time on the absolute time-line that AudioSettings.dspTime reads from. This is the preferred way to stitch AudioClips in music players because it is independent of the frame rate and gives the audio system enough time to prepare the playback of the sound to fetch it from media where the opening and buffering takes a lot of time (streams) without causing sudden CPU spikes.
Changes the time at which a sound that has already been scheduled to play will start. Notice that depending on the timing not all rescheduling requests can be fulfilled.
Changes the time at which a sound that has already been scheduled to play will end. Notice that depending on the timing not all rescheduling requests can be fulfilled.
Stops playing the clip.
Pauses playing the clip.
Returns a block of the currently playing source's output data.
Returns a block of the currently playing source's spectrum data.
Plays the clip at position. Automatically cleans up the audio source after it has finished playing.
Enabled Behaviours are Updated, disabled Behaviours are not.
The tag of this game object.
The name of the object.
Should the object be hidden, saved with the scene or modifiable by the user?
Returns the component of Type type if the game object has one attached, null if it doesn't.
Returns the component of Type type in the GameObject or any of its children using depth first search.
Returns all components of Type type in the GameObject or any of its children.
Returns all components of Type type in the GameObject.
Is this game object tagged tag?
Calls the method named methodName on every MonoBehaviour in this game object and on every ancestor of the behaviour.
Calls the method named methodName on every MonoBehaviour in this game object.
Calls the method named methodName on every MonoBehaviour in this game object or any of its children.
Returns the instance id of the object.
Returns the name of the game object.
Does the object exist?
Clones the object original and returns the clone.
Removes a gameobject, component or asset.
Destroys the object obj immediately. It is strongly recommended to use Destroy instead.
Returns a list of all active loaded objects of Type type.
Returns the first active loaded object of Type type.
Compares if two objects refer to the same.
Compares if two objects refer to a different object.
Makes the object target not be destroyed automatically when loading a new scene.