var jump: AudioClip[];
function Update () {
if (Input.GetKeyDown (KeyCode.Space))
{
GetComponent.<AudioSource>().PlayOneShot(jump);
if (GetComponent.<AudioSource>().isPlaying) return; // don't play a new sound while the last hasn't finished
clip = jump[Random.Range(2,jump.length)];
GetComponent.<AudioSource>().Play();
}
}
where pressing space at all will play one sound out of an array.
I couldn’t find much on the subject, if I could get any help to fix this, i would be greatful
Line 6 is essentially trying to pass the whole jump array into PlayOneShot(), which is where the error is coming from. Do you want to play jump[0] or jump[1] at the same time as the randomly selected sound? If so, add the index to the array name in line 6. If not, then I’m not sure what the point of that line is; maybe it isn’t supposed to be there?
Also, on line 9, use GetComponent.<AudioSource>().clip.
I think you missed some of that error message. Also, can you post your new code when you make updates to prevent miscommunications? I don’t know that you changed it exactly in the way that I meant to suggest.