Monday, June 27, 2011

Play sound ONCE


To play a sound once during Update() use a boolean variable or instantiate a GameObject with an AudioSource with the same settings.
function Start() {
soundplayed = false;
}

function Update () {
if (!soundplayed) {
audio.PlayOneShot(blast);
soundplayed = true;
}

No comments:

Post a Comment