Hi, I use the following code to change songs on a specific scene. How do I loop audio if I play music by code and not directly from the Audio Source Component?
Below is a part of my code, but it only plays the song 1 time and doesn’t loop:
if (lastScene == "MainMenu") {
audioSource.PlayOneShot (MainMenuSongAU, 0.4f);
Debug.Log ("Var lastScene is now: " + lastScene);
} else if (lastScene == "GameStartInfo") {
audioSource.Stop ();
audioSource.PlayOneShot (GreenHillsSongAU, 0.7f);