- Home /
Audio Clip duration not getting updated
Hi,
In my project I need to play a default audio at one instance and provide the option of recording a new audio file which will play there after.
I set the audio file (default or recorded) using audio.clip = {audioclip object containing audio}
Now, I need the length of the audio to make a slider run till the audio play gets completed. For this I used audio.clip.length to get the duration of the audio.
Problem is when I record an audio and assign it to audio.clip, it plays perfectly (through audio.Play()), but audio.clip.length returns a fixed value of 20.
Stranger still, once I rerun the application, the audio.clip.length gets refreshed and set to the correct value.
I'm confused why this is happening, I've tried several approaches but still I'm horribly stuck on this.
Can someone please help me out on why the audio.clip.length is behaving so strangely?
Thanks in advance
Your answer
![](https://koobas.hobune.stream/wayback/20220613093925im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
audio.clip Messing with Other Audio Clips? 0 Answers
Play an AudioSource 2 Answers
Audio not playing well on AudioListener move 1 Answer
Play Sound on Destroy 1 Answer