Skip to main content

AudioSource

info

AudioSource inherits from Behaviour

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

Members

Properties

NameDescription
AudioSource.bypassEffectsBypass effects (Applied from filter components or global listener filters).
AudioSource.bypassListenerEffectsWhen 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.bypassReverbZonesWhen set doesn't route the signal from an AudioSource into the global reverb associated with reverb zones.
AudioSource.clipThe default AudioClip to play.
AudioSource.dopplerLevelSets the Doppler scale for this AudioSource.
AudioSource.ignoreListenerPauseAllows 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.ignoreListenerVolumeThis makes the audio source not take into account the volume of the audio listener.
AudioSource.isPlayingIs the clip playing right now (Read Only)?
AudioSource.isVirtualTrue 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.loopIs the audio clip looping?
AudioSource.maxDistance(Logarithmic rolloff) MaxDistance is the distance a sound stops attenuating at.
(Linear rolloff) MaxDistance is the distance where the sound is completely inaudible.
AudioSource.minDistanceWithin the Min distance the AudioSource will cease to grow louder in volume.Outside the min distance the volume starts to attenuate.
AudioSource.muteUn- / Mutes the AudioSource. Mute sets the volume=0, Un-Mute restore the original volume.
AudioSource.outputAudioMixerGroupThe target group to which the AudioSource should route its signal.
AudioSource.panStereoPans a playing sound in a stereo way (left or right). This only applies to sounds that are Mono or Stereo.
AudioSource.pitchThe pitch of the audio source.
AudioSource.playOnAwakeIf set to true, the audio source will automatically start playing on awake.
AudioSource.prioritySets the priority of the AudioSource.
AudioSource.reverbZoneMixThe amount by which the signal from the AudioSource will be mixed into the global reverb associated with the Reverb Zones.
AudioSource.rolloffModeSets/Gets how the AudioSource attenuates over distance.
AudioSource.spatialBlendSets 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.spatializeEnables or disables spatialization.
AudioSource.spatializePostEffectsDetermines if the spatializer effect is inserted before or after the effect filters.
AudioSource.spreadSets the spread angle (in degrees) of a 3d stereo or multichannel sound in speaker space.
AudioSource.timePlayback position in seconds.
AudioSource.velocityUpdateModeWhether the Audio Source should be updated in the fixed or dynamic update.
AudioSource.volumeThe volume of the audio source (0.0 to 1.0).

Methods

NameDescription
AudioSource.GetAmbisonicDecoderFloat(index)Reads a user-defined parameter of a custom ambisonic decoder effect that is attached to an AudioSource.
AudioSource.GetCustomCurve(type)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)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)Reads a user-defined parameter of a custom spatializer effect that is attached to an AudioSource.
AudioSource.GetSpectrumData(Length, channel, window)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()Pauses playing the clip.
AudioSource.Play()Plays the clip.
AudioSource.PlayDelayed(delay)Plays the clip with a delay specified in seconds.
AudioSource.PlayOneShot(clip, volumeScale=0)Plays an AudioClip, and scales the AudioSource volume by volumeScale.
AudioSource.PlayScheduled(time)Plays the clip at a specific time on the absolute time-line that AudioSettings.dspTime reads from.
AudioSource.SetAmbisonicDecoderFloat(index, value)Sets a user-defined parameter of a custom ambisonic decoder effect that is attached to an AudioSource.
AudioSource.SetCustomCurve(type, curve)Set the custom curve for the given AudioSourceCurveType.
AudioSource.SetScheduledEndTime(time)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)Changes the time at which a sound that has already been scheduled to play will start.
AudioSource.SetSpatializerFloat(index, value)Sets a user-defined parameter of a custom spatializer effect that is attached to an AudioSource.
AudioSource.Stop()Stops playing the clip.
AudioSource.UnPause()Unpause the paused playback of this AudioSource.

Static Methods

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

Inherited Members

Inherited Properties

NameDescription
AudioSource.enabledEnabled Behaviours are Updated, disabled Behaviours are not.
AudioSource.isActiveAndEnabledHas the Behaviour had active and enabled called?
AudioSource.gameObjectThe game object this component is attached to. A component is always attached to a game object.
AudioSource.tagThe tag of this game object.
AudioSource.transformThe Transform attached to this GameObject.
AudioSource.hideFlagsShould the object be hidden, saved with the Scene or modifiable by the user?
AudioSource.nameThe name of the object.

Inherited Methods

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