API > AudioSource
AudioSource⚓︎
AudioSource inherits from Behaviour
A representation of audio sources in 3D. Check out Unity AudioSource
Members⚓︎
Properties⚓︎
Name | Description |
---|---|
AudioSource .bypassEffects |
Bypass effects (Applied from filter components or global listener filters). |
AudioSource .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. |
AudioSource .bypassReverbZones |
When set doesn't route the signal from an AudioSource into the global reverb associated with reverb zones. |
AudioSource .clip |
The default AudioClip to play. |
AudioSource .dopplerLevel |
Sets the Doppler scale for this AudioSource. |
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. |
AudioSource .ignoreListenerVolume |
This makes the audio source not take into account the volume of the audio listener. |
AudioSource .isPlaying |
Is the clip playing right now (Read Only)? |
AudioSource .isVirtual |
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 .loop |
Is 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 .minDistance |
Within the Min distance the AudioSource will cease to grow louder in volume.Outside the min distance the volume starts to attenuate. |
AudioSource .mute |
Un- / Mutes the AudioSource. Mute sets the volume=0, Un-Mute restore the original volume. |
AudioSource .outputAudioMixerGroup |
The target group to which the AudioSource should route its signal. |
AudioSource .panStereo |
Pans a playing sound in a stereo way (left or right). This only applies to sounds that are Mono or Stereo. |
AudioSource .pitch |
The pitch of the audio source. |
AudioSource .playOnAwake |
If set to true, the audio source will automatically start playing on awake. |
AudioSource .priority |
Sets the priority of the AudioSource. |
AudioSource .reverbZoneMix |
The amount by which the signal from the AudioSource will be mixed into the global reverb associated with the Reverb Zones. |
AudioSource .rolloffMode |
Sets/Gets how the AudioSource attenuates over distance. |
AudioSource .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. |
AudioSource .spatialize |
Enables or disables spatialization. |
AudioSource .spatializePostEffects |
Determines if the spatializer effect is inserted before or after the effect filters. |
AudioSource .spread |
Sets the spread angle (in degrees) of a 3d stereo or multichannel sound in speaker space. |
AudioSource .time |
Playback position in seconds. |
AudioSource .velocityUpdateMode |
Whether the Audio Source should be updated in the fixed or dynamic update. |
AudioSource .volume |
The volume of the audio source (0.0 to 1.0). |
Methods⚓︎
Name | Description |
---|---|
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⚓︎
Name | Description |
---|---|
AudioSource .PlayClipAtPoint(clip, position, volume=1.0) |
Plays an AudioClip at a given position in world space. |
Inherited Members⚓︎
Inherited Properties⚓︎
Name | Description |
---|---|
AudioSource .enabled |
Enabled Behaviours are Updated, disabled Behaviours are not. |
AudioSource .isActiveAndEnabled |
Has the Behaviour had active and enabled called? |
AudioSource .gameObject |
The game object this component is attached to. A component is always attached to a game object. |
AudioSource .tag |
The tag of this game object. |
AudioSource .transform |
The Transform attached to this GameObject. |
AudioSource .hideFlags |
Should the object be hidden, saved with the Scene or modifiable by the user? |
AudioSource .name |
The name of the object. |
Inherited Methods⚓︎
Name | Description |
---|---|
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. |