I have created a script (that has some more in it) but i have displayed the important parts that are involved with the problem. The script allows a block to display a different colour depending on what random number it’s given. For some reason when i select the good blocks they don’t play the audio clip just once it constantly repeats despite the use of oneShot.
var backspin : boolean;
public var GoodSound : AudioClip;
function Update () {
if(backspin == true){
retexture -= Time.deltaTime;
if(retexture < 0){
if(number < 4){
Bad ();
}
if(number >= 4){
Good ();
audio.PlayOneShot (GoodSound);
}
}
}
}
function OnMouseDown () {
backspin = true;
}
can anyone help? i can put the whole script in if needs be, just didn’t want too put in too much.