Hey guys I just started putting sounds into my project and I came along a problem. I have tried to find a solution on the forums and through google but there is little that is helping. I basically want to change an audioclip being played based on the number of a variable. I find that the audio clip is successfully changing, but I believe because it is updating over and over that the audioclip does not have a chance to complete before it instantly starts again.
Here is my script
var thrustidle : AudioClip;
var thrustone : AudioClip;
var thrusttwo : AudioClip;
var thrustthree : AudioClip;
var thrusters: AudioClip;
function Update () {
if (BasicFlightControl.throttle <= 0) {
audio.clip = thrustidle;
audio.Play();
}
if (BasicFlightControl.throttle >= 1 BasicFlightControl.throttle <=3) {
audio.clip = thrustone;
audio.Play();
}
if (BasicFlightControl.throttle >= 4 BasicFlightControl.throttle <=6) {
audio.clip = thrusttwo;
audio.Play();
}
if (BasicFlightControl.throttle >= 7 BasicFlightControl.throttle <=10) {
audio.clip = thrustthree;
audio.Play();
}
}
How would I go about modifying it so that it does not keep trying to play all the time?