I understand that questions like this have been asked before, but I haven’t been successful in using any solutions for what I currently have. I have this code set up so that when a menu opens within a game a randomly selected piece of music will play from a range. The music plays fine, but I can’t work out how to make it loop when it ends.
This is the main part of code I have for how I’ve tried to make it loop:
void music()
{
source = GetComponent<AudioSource>();
source.loop = true;
source.PlayOneShot(menu);
}