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.
bypassEffects | Bypass effects (Applied from filter components or global listener filters). |
bypassListenerEffects | 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. |
bypassReverbZones | When set doesn't route the signal from an AudioSource into the global reverb associated with reverb zones. |
clip | The default AudioClip to play. |
dopplerLevel | Sets the Doppler scale for this AudioSource. |
ignoreListenerPause | 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. |
ignoreListenerVolume | This makes the audio source not take into account the volume of the audio listener. |
isPlaying | Is the clip playing right now (Read Only)? |
loop | Is the audio clip looping? |
maxDistance | (Logarithmic rolloff) MaxDistance is the distance a sound stops attenuating at. |
minDistance | Within the Min distance the AudioSource will cease to grow louder in volume. |
mute | Un- / Mutes the AudioSource. Mute sets the volume=0, Un-Mute restore the original volume. |
outputAudioMixerGroup | The target group to which the AudioSource should route its signal. |
panStereo | Pans a playing sound in a stereo way (left or right). This only applies to sounds that are Mono or Stereo. |
pitch | The pitch of the audio source. |
playOnAwake | If set to true, the audio source will automatically start playing on awake. |
priority | Sets the priority of the AudioSource. |
reverbZoneMix | The amount by which the signal from the AudioSource will be mixed into the global reverb associated with the Reverb Zones. |
rolloffMode | Sets/Gets how the AudioSource attenuates over distance. |
spatialBlend | Sets how much this AudioSource is affected by 3D spatialisation calculations (attenuation, doppler etc). 0.0 makes the sound full 2D, 1.0 makes it full 3D. |
spatialize | Enables or disables spatialization. |
spread | Sets the spread angle (in degrees) of a 3d stereo or multichannel sound in speaker space. |
time | Playback position in seconds. |
timeSamples | Playback position in PCM samples. |
velocityUpdateMode | Whether the Audio Source should be updated in the fixed or dynamic update. |
volume | The volume of the audio source (0.0 to 1.0). |
GetCustomCurve | Get the current custom curve for the given AudioSourceCurveType. |
GetSpatializerFloat | Reads a user-defined parameter of a custom spatializer effect that is attached to an AudioSource. |
Pause | Pauses playing the clip. |
Play | Plays the clip with an optional certain delay. |
PlayDelayed | 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. |
PlayOnDualShock4 | Enable playing of audio source though a specfic DualShock4 controllerEnable playing of audio source though a specfic DualShock4 controller. |
PlayOneShot | Plays an AudioClip, and scales the AudioSource volume by volumeScale. |
PlayScheduled | Plays the clip at a specific time on the absolute time-line that AudioSettings.dspTime reads from. |
SetCustomCurve | Set the custom curve for the given AudioSourceCurveType. |
SetScheduledEndTime | 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. |
SetScheduledStartTime | Changes the time at which a sound that has already been scheduled to play will start. |
SetSpatializerFloat | Sets a user-defined parameter of a custom spatializer effect that is attached to an AudioSource. |
Stop | Stops playing the clip. |
UnPause | Unpause the paused playback of this AudioSource. |
PlayClipAtPoint | Plays an AudioClip at a given position in world space. |
enabled | Enabled Behaviours are Updated, disabled Behaviours are not. |
isActiveAndEnabled | Has the Behaviour had enabled called. |
gameObject | The game object this component is attached to. A component is always attached to a game object. |
tag | El tag de este game object. |
transform | The Transform attached to this GameObject (null if there is none attached). |
hideFlags | Should the object be hidden, saved with the scene or modifiable by the user? |
name | El nombre del objeto. |
BroadcastMessage | Llama al método denominado methodName de todos los MonoBehaviour en este game objecto en cualquiera de sus hijos. |
CompareTag | ¿Este game object está etiquetado con tag? |
GetComponent | Devuelve un componente de tipo type si el game object tiene a alguno adjuntado, o null si no lo tiene. |
GetComponentInChildren | Returns the component of Type type in the GameObject or any of its children using depth first search. |
GetComponentInParent | Returns the component of Type type in the GameObject or any of its parents. |
GetComponents | Returns all components of Type type in the GameObject. |
GetComponentsInChildren | Returns all components of Type type in the GameObject or any of its children. |
GetComponentsInParent | Returns all components of Type type in the GameObject or any of its parents. |
SendMessage | Llama al método denominado methodName en cada MonoBehaviour de este game object. |
SendMessageUpwards | Llama al método denominado methodName en todos los MonoBehaviour de este juego y en todos los ancestros del behaviour. |
GetInstanceID | Returns the instance id of the object. |
ToString | Devuelve el nombre del objeto. |
Destroy | Elimina un gameobject, componente o asset. |
DestroyImmediate | Destroys the object obj immediately. You are strongly recommended to use Destroy instead. |
DontDestroyOnLoad | Makes the object target not be destroyed automatically when loading a new scene. |
FindObjectOfType | Devuelve el primer objeto activo cargado de tipo type. |
FindObjectsOfType | Devuelve una lista de todos los objetos activos cargados de tipo type. |
Instantiate | Devuelve el nombre del objeto. |
bool | ¿Existe el objeto? |
operator != | Compares if two objects refer to a different object. |
operator == | Compares two object references to see if they refer to the same object. |