- Home /
Audio for colliding blocks
I have a group of blocks that tumble down, colliding with each other. Currently, each block has the same monobehavior that plays an AudioClip OnCollisionEnter. Unfortunately, this means at each collision, the sound plays twice, being called from the block on each side of the collision, unnecessarily doubling all the audio calls.
At each collision point, I would like one sound to play rather than two. What would be a good strategy for this? I was thinking of adding collisions to a global list and if two collisions are at the same point (or if the collision instance is the same, I could check if it is already in the list before adding), play one sound when traversing the final list. But this may be computationally intensive. Is there a more optimal way to play one sound when two of the same blocks collide?
Your answer
Follow this Question
Related Questions
Imported 3D models collisions 1 Answer
FPS Tutorial: Why do my grenades go through the walls? 3 Answers
Exported Scene in .swf loses 2D colliders ? 1 Answer
Wind physics script 1 Answer