- Home /
Music volume decreases after one loop
The background music for my game decreases significantly after one loop. Anyone have an idea why? I've poked around all of the settings I could think of.
Yes, it happens everywhere. And nothing that I've seen in the inspector changes when this happens. I don't have any scripts affecting audio beyond Play() and Stop().
I can't tell if this is an issue with Unity or not, but because it happens on loop Unity does look like the culprit. Have you tried reimporting the audio files? Does this happen with every project? Does the volume decrease in relation to how loud it was previously?
I've tried reimporting the audio file and that didn't work. I also took the audio file and saved it as an $$anonymous$$P3 (it was originally a WAV), and imported it. That didn't work either. None of my other projects do this. This is from the Space Shooter tutorial from Unity. I noticed this same behavior quite a while ago when I went through this tutorial before, but I overlooked it since I was very new to game development. I revisited this tutorial to try to reinforce some concepts when I noticed it again, and now I'd like to figure out what is going on.
Answer by godssalvation · Feb 23, 2020 at 08:06 PM
Hello,
I know it has been awhile since you posted your question and I see that you have somewhat discovered the solution, but perhaps this may help anyone else who may have encountered this issue. I cannot say for certain, but assuming that all of the settings are set as you expect; the most likely cause for this is that you have two audio sources playing the same audio, but only one is set to loop. When the second audio source drops out from the first time the clip reaches its end point, the volume virtually halves because if multiple audio sources play the same clip, then Unity handles it as an amplification. Using multiple Audio Sources to play the same clip can be interesting to have unique effects, but it is best to only have one audio source play a single clip unless for some reason you feel that the MAX volume of a single source still needs some extra boost. Anyways, I hope this helps to solve this issue for anyone who might have this specific issue. P.S. - in your instance, since you imported a project, I assume that you built an identical object with an identical audio source which is why the music continued to loop even though the loop box was unmarked (i.e. - after disabling the audio source that wasn't set to loop, the remaining active one that was set to loop played solo and therefore acted as expected)
Your answer
Follow this Question
Related Questions
Why is my backtrack's volume getting lower? 0 Answers
Problem with seamless music looping in Unity 5 1 Answer
Audio slider for multiple scenes. 2 Answers
Decrease Volume 3 Answers