- Home /
Sound is stopping prematurely (Read Description)
Alright so this is a strange one. Everything I have searched for has been the opposite of what I need. Let me explain what's going on. In short, I am working on a 2D naval battle game. When the cannons fire, they of course have a cannon fire sound effect. I am using:
AudioSource.PlayClipAtPoint
Which works just fine except for one thing. If a cannonball collides with something like the UI or another ship earlier than the cannon fire effect finishes playing. There is a noticeable change in audio volume like the cannon sound effect for the cannon that the round came from stops playing. It's really odd. The audio source is not attached to the cannonball so the Audio Source is not being destroyed with the cannonball. The only explanation I can come up with is that something is causing the sound to stop playing when OnDestroy() is called. (we are using OnDestroy for some stuff).
I'd rather not post the source code here as it's a private project right now. The main factors are that there is a cannon fire sound effect for each cannon that all play when the cannons fire. This means that there are multiple cannon fire sounds playing at once. When a cannonball hits something before the sound effect has finished playing, there is a noticeable change in volume of the sound effects until you can tell there is only one sound effect left playing. Is this a known issue to happen or does this sound like an extremely wacky bug?
Your answer
Follow this Question
Related Questions
How to play an audio one shot clip on a collision 1 Answer
On Collision, Play Sound If Button Is Pressed 1 Answer
OnTriggerExit stop audio 1 Answer
Walking sound changing on surface 1 Answer
Audio on Collision Issue 1 Answer