I have a set of music tracks in my project and I want them to play a random track every time the previous one has ended. (Like the method EA uses). I know I need to use Random.range to play random tracks, but I want to check if one has ended before the other starts playing. Is there a static Boolean I don’t know from the AudioSource class that does this?
Yes. It’s called AudioSource.isPlaying
You can check AudioSource.isPlaying each frame to know if a clip is still playing or not. Otherwise you can use AudioSource.clip.length as an amount of time to wait before moving on, perhaps using a coroutine WaitForSeconds, or using timestamp comparison each frame.