- Home /
Question by
Sausagesauce · Aug 06, 2013 at 05:44 PM ·
audiotime
Check if Audio is at a specific time
I want an object to move up when an audio track (played from the same object) reaches 8 seconds. Here's my javascript code:
function Update(){
if (AudioSource.time=8{
transform.Translate(Vector3.up * (Time.fixedDeltaTime * 5)
}
}
I know there's a lot going wrong here, by the way. My only real problem is that I don't know how to use the if statement with AudioSource.time.
Comment
unless you create a helper/wrapper class the best you have is clip.length, so counter/coroutine?
Your answer
![](https://koobas.hobune.stream/wayback/20220613111644im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Is there a way to wait a certain amount of time before the audio plays again 0 Answers
Using Time with OnGUI Help 2 Answers
how to play audio at a given time. 2 Answers
TimeScale with AudioSource 1 Answer