Unity Audio Questions

First, what’s the best way to play sounds when hitting multiple objects simultaneously? In bowlmaster I want to play sounds based on the number of pins hit. If I hit a single pin I want to play single hit pin audio clip. If I hit 10 pins I want to play the strike audioclip. What would be the best way to approach this?

Second, any good tutorials on layering sounds in Unity so that they create cohesive and complex audio situations? I’d take a general unity course at all.

I’ve given it a little thought.
Here’s the possible solution I’ve come up with.
Create an empty game object, name it something like soundplayer.
Make a function This function will update an int variable pinsKnockedDown by 1, and if it hasn’t already, starts a timer. Once say half a second has passed, it checkes pinsKnockedDown, and based on how high the number is, determines what sound file to play, then it resets the variable to 0.

In your pins script, in your collision detection function, have it call the sound players function you created above.

You might have to play with the timer a little bit to count the most pins, but keep it small enough that the delay before it plays the audio file isn’t noticeable.

This probably isn’t the only way to go about it, and may not be the best way, but it should work.

Worked great. Thank you.

Privacy & Terms