ok i got it working after realizing i had to drag the actual audio source component from the inspector into the script’s waiting audio source field, NOT drag the audio file there
now the problem is that it plays the file on every frame, instead of just starting.
i assume that’s just a job for audioclip.length to make sure its done playing?
edit: wait what the hell? now it’s giving a constant error that “update() is not a coroutine” and will not run anything within update
static var currentTime : int; // What the current time is.
static var songLength : int; // The length of the song.
static var timeLeft : int; // how much time remains.
function Update() {
songLength = audio.clip.length;
currentTime = audio.time;
timeLeft = songLength - currentTime;
if (timeLeft <= 0) {
//Do whatever you want to do when the song is over.
}
}