Play audio clip

From ETC Public Wiki
Jump to: navigation, search

Play an audio clip in code

this uses 3D sound so the volume is based on the distance from the listener applied to the camera.


load the audio clip in the inspector

 var clip : AudioClip;


to play it:

 AudioSource.PlayClipAtPoint(clip,transform.position,1);