Hi, I’m a beginner developer and I tried to make a radio that would change the song playing, I used a switch statement but when I try to use the radio nothing happens. There are no errors in the console, and the interact button works with other objects. I also tried to put a default part in the statement with a debug log, but it doesn’t do anything either. Also, the boolean isInRangeRadio works as expected. It’s probably a dumb mistake, as this is the first time I’m learning to use switch statements.
Any help? This is the code for the statement.
public int SongPlaying = 0;
public void RadioFn()
{
if (isInRangeRadio)
{
switch (SongPlaying)
{
case 0:
SongDefault.Stop();
Song1.Play();
SongPlaying = 1;
Debug.Log("E");
break;
case 1:
Song1.Stop();
Song2.Play();
SongPlaying = 2;
break;
case 2:
Song2.Stop();
Song3.Play();
SongPlaying = 3;
break;
case 3:
Song3.Stop();
Song1.Play();
SongPlaying = 1;
break;
}
}
}