Hi guys! I am trying to make a boom box or stereo so that when the mouse is hovered over the stereo and press ‘M’ the first song in the list plays, then if they press ‘M’ again the next song in the list plays. I eventually want it to loop (haven’t done the looping yet) but when I try out my code, there are no errors yet the song isn’t playing and track song # isn’t adding 1. Here is my code, thanks for any help.
public var JustDrive : AudioClip;
public var Song2 : AudioClip;
public var Song3 : AudioClip;
public var Song4 : AudioClip;
public var songcounter : int = 0;
function OnMouseEnter () {
if(Input.GetKey(KeyCode.M)){
if(songcounter == 0){
audio.PlayOneShot(JustDrive);
songcounter += 1;
}
if(songcounter == 1){
audio.PlayOneShot(JustDrive);
songcounter += 1;
}
if(songcounter == 3){
audio.PlayOneShot(Song3);
songcounter += 1;
}
if(songcounter == 4){
audio.PlayOneShot(Song4);
songcounter += 1;
}
}
}