Skip to content

API > AudioSource


AudioSource⚓︎

AudioSource inherits from Behaviour

A representation of audio sources in 3D. Check out Unity AudioSource

Members⚓︎

Properties⚓︎

Name Description
AudioSource.bypassEffectsProperty Bypass effects (Applied from filter components or global listener filters).
AudioSource.bypassListenerEffectsProperty 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.
AudioSource.bypassReverbZonesProperty When set doesn't route the signal from an AudioSource into the global reverb associated with reverb zones.
AudioSource.clipProperty The default AudioClip to play.
AudioSource.dopplerLevelProperty Sets the Doppler scale for this AudioSource.
AudioSource.ignoreListenerPauseProperty 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.
AudioSource.ignoreListenerVolumeProperty This makes the audio source not take into account the volume of the audio listener.
AudioSource.isPlayingProperty Is the clip playing right now (Read Only)?
AudioSource.isVirtualProperty True if all sounds played by the AudioSource (main sound started by Play() or playOnAwake as well as one-shots) are culled by the audio system.
AudioSource.loopProperty Is the audio clip looping?
AudioSource.maxDistanceProperty (Logarithmic rolloff) MaxDistance is the distance a sound stops attenuating at.
(Linear rolloff) MaxDistance is the distance where the sound is completely inaudible.
AudioSource.minDistanceProperty Within the Min distance the AudioSource will cease to grow louder in volume.Outside the min distance the volume starts to attenuate.
AudioSource.muteProperty Un- / Mutes the AudioSource. Mute sets the volume=0, Un-Mute restore the original volume.
AudioSource.outputAudioMixerGroupProperty The target group to which the AudioSource should route its signal.
AudioSource.panStereoProperty Pans a playing sound in a stereo way (left or right). This only applies to sounds that are Mono or Stereo.
AudioSource.pitchProperty The pitch of the audio source.
AudioSource.playOnAwakeProperty If set to true, the audio source will automatically start playing on awake.
AudioSource.priorityProperty Sets the priority of the AudioSource.
AudioSource.reverbZoneMixProperty The amount by which the signal from the AudioSource will be mixed into the global reverb associated with the Reverb Zones.
AudioSource.rolloffModeProperty Sets/Gets how the AudioSource attenuates over distance.
AudioSource.spatialBlendProperty 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.
AudioSource.spatializeProperty Enables or disables spatialization.
AudioSource.spatializePostEffectsProperty Determines if the spatializer effect is inserted before or after the effect filters.
AudioSource.spreadProperty Sets the spread angle (in degrees) of a 3d stereo or multichannel sound in speaker space.
AudioSource.timeProperty Playback position in seconds.
AudioSource.velocityUpdateModeProperty Whether the Audio Source should be updated in the fixed or dynamic update.
AudioSource.volumeProperty The volume of the audio source (0.0 to 1.0).

Methods⚓︎

Name Description
AudioSource.GetAmbisonicDecoderFloat(index) Method Reads a user-defined parameter of a custom ambisonic decoder effect that is attached to an AudioSource.
AudioSource.GetCustomCurve(type) Method Get the current custom curve for the given AudioSourceCurveType.
Note that if there is no curve set, or the corresponding curve type value setter has been set, a single key AnimationCurve will be returned corresponding to the current value.
AudioSource.GetOutputData(length, channel) Method Provides a block of the currently playing source's output data.
The array given in the samples parameter will be filled with the requested data.
AudioSource.GetSpatializerFloat(index) Method Reads a user-defined parameter of a custom spatializer effect that is attached to an AudioSource.
AudioSource.GetSpectrumData(Length, channel, window) Method Provides a block of the currently playing audio source's spectrum data.
The array given in the samples parameter will be filled with the requested data.
AudioSource.Pause() Method Pauses playing the clip.
AudioSource.Play() Method Plays the clip.
AudioSource.PlayDelayed(delay) Method Plays the clip with a delay specified in seconds.
AudioSource.PlayOneShot(clip, volumeScale=0) Method Plays an AudioClip, and scales the AudioSource volume by volumeScale.
AudioSource.PlayScheduled(time) Method Plays the clip at a specific time on the absolute time-line that AudioSettings.dspTime reads from.
AudioSource.SetAmbisonicDecoderFloat(index, value) Method Sets a user-defined parameter of a custom ambisonic decoder effect that is attached to an AudioSource.
AudioSource.SetCustomCurve(type, curve) Method Set the custom curve for the given AudioSourceCurveType.
AudioSource.SetScheduledEndTime(time) Method 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.
AudioSource.SetScheduledStartTime(time) Method Changes the time at which a sound that has already been scheduled to play will start.
AudioSource.SetSpatializerFloat(index, value) Method Sets a user-defined parameter of a custom spatializer effect that is attached to an AudioSource.
AudioSource.Stop() Method Stops playing the clip.
AudioSource.UnPause() Method Unpause the paused playback of this AudioSource.

Static Methods⚓︎

Name Description
AudioSource.PlayClipAtPoint(clip, position, volume=1.0) Static fieldMethod Plays an AudioClip at a given position in world space.

Inherited Members⚓︎

Inherited Properties⚓︎

Name Description
AudioSource.enabledProperty Enabled Behaviours are Updated, disabled Behaviours are not.
AudioSource.isActiveAndEnabledProperty Has the Behaviour had active and enabled called?
AudioSource.gameObjectPropertyReadonly Property The game object this component is attached to. A component is always attached to a game object.
AudioSource.tagPropertyReadonly Property The tag of this game object.
AudioSource.transformPropertyReadonly Property The Transform attached to this GameObject.
AudioSource.hideFlagsProperty Should the object be hidden, saved with the Scene or modifiable by the user?
AudioSource.nameProperty The name of the object.

Inherited Methods⚓︎

Name Description
AudioSource.BroadcastMessage(methodName, parameter=nil)Method Calls the method named methodName on every Lua Script in this game object or any of its children.
AudioSource.CompareTag(tag)Method Is this game object tagged with tag ?
AudioSource.GetAllLuaScripts()Method Returns an array of all Lua scripts that attached to the game object.
AudioSource.GetComponent(type)Method Returns the component of Type type if the game object has one attached, nil if it doesn't.
AudioSource.GetComponentInChildren(t)Method Returns the component of Type type in the GameObject or any of its children using depth first search.
AudioSource.GetComponentInParent(t)Method Returns the component of Type type in the GameObject or any of its parents.
AudioSource.GetComponents(type)Method Returns all components of Type type in the GameObject.
AudioSource.GetComponentsInChildren(t)Method Returns all components of Type type in the GameObject or any of its children.
AudioSource.GetComponentsInParent(t)Method Returns all components of Type type in the GameObject or any of its parents.
AudioSource.SendMessage(methodName, value=nil)Method Calls the method named methodName on every Lua Script in this game object.
AudioSource.SendMessageUpwards(methodName, value=nil)Method Calls the method named methodName on every LuaScript in this game object and on every ancestor of the behaviour.
AudioSource.TryGetComponent(type)Method Gets the component of the specified type, if it exists.
AudioSource.GetInstanceID()Method Returns the instance id of the object.