Documentation
Resources
Community
Manual
Reference
Scripting
Scripting
>
Runtime Classes
>
AudioSource
Switch to Component
Menu
Overview
Runtime Classes
Attributes
Enumerations
Editor Classes
Enumerations
History
Index
AudioSource
All Members
Variables
clip
ignoreListenerVolume
isPlaying
loop
maxVolume
minVolume
pitch
playOnAwake
rolloffFactor
time
timeSamples
velocityUpdateMode
volume
Functions
Pause
Play
PlayOneShot
Stop
Class Functions
PlayClipAtPoint
Inherited Variables
animation
audio
camera
collider
constantForce
enabled
gameObject
guiText
guiTexture
hideFlags
hingeJoint
light
name
networkView
particleEmitter
renderer
rigidbody
tag
transform
Inherited Functions
BroadcastMessage
CompareTag
GetComponent
GetComponentInChildren
GetComponents
GetComponentsInChildren
GetInstanceID
SendMessage
SendMessageUpwards
Inherited Class Functions
Destroy
DestroyImmediate
DontDestroyOnLoad
FindObjectOfType
FindObjectsOfType
Instantiate
operator !=
operator ==
operator bool
AudioSource
.PlayOneShot
function
PlayOneShot (clip :
AudioClip
, volumeScale :
float
= 1.0F) :
void
Description
Plays an
AudioClip
.
// Play impact audio clip when colliding with something
var
impact :
AudioClip
;
function
OnCollisionEnter
() {
audio.PlayOneShot(impact);
}