Is it possible to check if an AudioClip played through a specific time?

Hi there,

Unity is a great tool! I am a game artist and learning JavaScript to make my own games, (not entirely enjoying programming as of yet…) but I’ve run into a problem which I can’t find a solution to.

In my project, to play background music, I created a seperate scene with a script, which uses DontDestroyOnLoad and carries on through the menus and levels playing music.
What I want to do, is in a different level to check whether the music track has reached, say, 1:04 mark. Is that possible? I really need to do this, because I want to trigger several events based on some chords in the music track.

I can’t really write if Time.time > 1:04, because the song starts playing before the level starts, when the player presses “Play”.

Do you have any suggestions? :\

Check out the documentation for AudioSource (note in particular the ‘time’ field).

Ah, thanks! I constantly look through the scripting reference, but I didn’t find that property. :slight_smile: