AudioSource is a component used to play sounds. You can assign an AudioClip to an AudioSource to control sound playback, adjust volume, change pitch, loop sounds, and manage spatial effects for 3D audio. Unity's AudioSource Documentation
Properties
Bypasses applied effects, playing the original sound when true. Unity's AudioSource.bypassEffects Documentation
Bypasses 3D spatialization effects when true, affecting volume and pitch directly. Unity's AudioSource.bypassListenerEffects Documentation
Allows bypassing Global Reverb Zones for direct sound play when true. Unity's AudioSource.bypassReverbZones Documentation
Holds the AudioClip to be played, allowing for the assignment of sound to the AudioSource. Unity's AudioSource.clip Documentation
Sets the amount of Doppler effect, changing sound frequency based on movement. Unity's AudioSource.dopplerLevel Documentation
Allows the AudioSource to keep playing despite a global pause, when set to true. Unity's AudioSource.ignoreListenerPause Documentation
When true, AudioSource ignores global volume controls, playing audio at its own volume level. Unity's AudioSource.ignoreListenerVolume Documentation
Indicates if the AudioSource is currently playing sound, useful for checking audio status. Unity's AudioSource.isPlaying Documentation
Indicates whether the AudioSource is virtualized, which has minimal resource usage. Unity's AudioSource.isVirtual Documentation
When true, the audio clip will play indefinitely in a loop, useful for background music or repeating sounds. Unity's AudioSource.loop Documentation
Defines the maximum distance where attenuation stops, setting the farthest point for audio volume reduction. Unity's AudioSource.maxDistance Documentation
Sets the minimum distance for the AudioSource to start attenuating, controlling volume over distance. Unity's AudioSource.minDistance Documentation
Mutes the AudioSource when true, stopping any sound from being played. Unity's AudioSource.mute Documentation
Controls the left and right stereo pan, aiding in achieving desired sound effects. Unity's AudioSource.panStereo Documentation
Controls the speed of sound playback. Adjusting the pitch changes the sound's speed and pitch. Unity's AudioSource.pitch Documentation
Determines if the audio clip will start playing automatically when the script activates. Unity's AudioSource.playOnAwake Documentation
Determines the AudioSource's priority among others for managing active AudioSource objects and playback selection based on priority value. Unity's AudioSource.priority Documentation
Controls the mix of spatialized AudioSource into global reverb, enhancing audio depth. Unity's AudioSource.reverbZoneMix Documentation
Sets the level of 3D audio effect application on the audio playback. Unity's AudioSource.spatialBlend Documentation
Activates spatializer effect for immersive 3D audio when set to true. Unity's AudioSource.spatialize Documentation
Applies spatial effects to the AudioSource for enhanced audio experience when true. Unity's AudioSource.spatializePostEffects Documentation
Controls audio spread across speakers in 3D playback, affecting sound directionality. Unity's AudioSource.spread Documentation
Sets or returns the current playback position in seconds, allowing for precise control over playback. Unity's AudioSource.time Documentation
Allows setting and retrieving the playback position in PCM samples for precise audio timing. Unity's AudioSource.timeSamples Documentation
Manages the loudness of the audio playing through the AudioSource. Adjust this property to control volume levels. Unity's AudioSource.volume Documentation
Methods
Parameters
index
Returns
Pauses the audio playback, allowing for later resumption from the same point. Unity's AudioSource.Pause Documentation
Returns
Starts playing the assigned audio clip, allowing for sound playback control. Unity's AudioSource.Play Documentation
Returns
Starts playing the assigned audio clip, allowing for sound playback control. Unity's AudioSource.Play Documentation
Parameters
delay
Returns
Plays an AudioClip at a specified world position, as a static method. Unity's AudioSource.PlayClipAtPoint Documentation
Plays an AudioClip at a specified world position, as a static method. Unity's AudioSource.PlayClipAtPoint Documentation
Plays the assigned audio clip after a delay, useful for timed sound effects. Unity's AudioSource.PlayDelayed Documentation
Parameters
delay
The delay time in seconds before the audio clip starts playing.
Returns
Plays an audio clip once on demand, ignoring the AudioSource's regular clip. Unity's AudioSource.PlayOneShot Documentation
Parameters
clip
The audio clip to play once.
Returns
Plays an audio clip once on demand, ignoring the AudioSource's regular clip. Unity's AudioSource.PlayOneShot Documentation
Parameters
clip
The audio clip to play once.
volumeScale
Returns
Schedules audio clip playback at a precise time, aiding in synchronized audio events. Unity's AudioSource.PlayScheduled Documentation
Parameters
time
The time in seconds when the audio clip will start playing.
Returns
Schedules a stop time for audio clip playback, useful for precise audio event control. Unity's AudioSource.SetScheduledEndTime Documentation
Parameters
time
The scheduled end time in seconds for the audio clip.
Returns
Schedules the start time for audio clip playback, organizing audio in precise manner. Unity's AudioSource.SetScheduledStartTime Documentation
Parameters
time
The scheduled start time in seconds for the audio clip.
Returns
Sets a float parameter for a spatializer effect attached to the AudioSource. Unity's AudioSource.SetSpatializerFloat Documentation
Parameters
index
The index of the parameter in the spatializer effect.
value
The new value for the specified parameter.
Returns
Stops currently playing audio, useful for immediate sound halt. Unity's AudioSource.Stop Documentation
Returns
Resumes paused audio playback from where it was stopped. Unity's AudioSource.UnPause Documentation
Returns
Updated 9 days ago