[Solved] 'Boing' and 'crack' sounds both playing when brick is hit

Hey everyone,

So I’ve been following the videos and when Ben added the boing sound to the ball, it didn’t make the noise when it hit a single hit brick (one that is destroyed on one hit), however in my game it did make a sound. Then, when he added the crack sound to be made when a brick is hit, it was hard to hear but it sounded like only the crack sound was being played when a brick was hit, not the boing as well.

In my game, both sounds are being played when a brick is hit or destroyed. How can I make it so the boing doesn’t play when a brick is hit?

I’m not sure what code/examples of mine to include.

Hi @Bakesauce,

The two scripts to view/post would be Brick.Cs and Ball.cs.

However they are triggered at the same time. So you should hear both. The key for you maybe to look at the Audio Source component attached to Ball and Brick prefab and adjust the Volume slider ( which is about mid way down the component menu in the inspector) until you get a balance to suit yourself.

You could investigate the boing not being triggered by the brick that cracks, I guess an If ( collider attached to brick with audio) { don’t play} else (play) or something simular?

Anyway hope that helps a little.

Just for clarity

Hey,

Thanks for the response. So because we set up the sounds for the brick and the balls in a different way, there is no audio source component for the brick prefab. Is there any other way to alter the sound of the crack noise?

I am sorry, I forgot how that was done…

yes

AudioSource.PlayClipAtPoint (crack, transform.position, 0.09f)

the 0.09 float at the end of the line is the volume control via script.

Sweet. Thanks so much!

My pleasure. I think you should mark question solved.

I had the same problem, did you find a better fix than tweaking the volume settings?