|
Plays an AudioClip.
Scales the AudioSource volume by volumeScale.
@script RequireComponent(AudioSource)
// Play impact audio clip when colliding with something
var impact : AudioClip;
function OnCollisionEnter () {
audio.PlayOneShot(impact);
}
using UnityEngine;
using System.Collections;
[RequireComponent(typeof(AudioSource))]
public class example : MonoBehaviour {
public AudioClip impact;
void OnCollisionEnter() {
audio.PlayOneShot(impact);
}
}
import UnityEngine
import System.Collections
[RequireComponent(AudioSource)]
class example(MonoBehaviour):
public impact as AudioClip
def OnCollisionEnter():
audio.PlayOneShot(impact)