lundi 5 janvier 2015

My audio.Play wont play outside function Update

i have this code that should start/stop my sound file when the rigidbody is/is not moving. I have succesfully made my booleans trigger from this but my sound wont play. What am i missing here? thx!


var audioPlayed : boolean = false;



function Update()
{

if(!rigidbody.IsSleeping())
{

audioPlayed = true;

}

if(rigidbody.IsSleeping())
{

audioPlayed = false;
}


}

if(audioPlayed == true)
{
audio.Play();
}

Aucun commentaire:

Enregistrer un commentaire