Unity Physics Sound

Updated: Nov 12, 2019

GitHub Repo: https://github.com/sharploris/unity-physics-sound

Unity Physics Sound is a small utility I worked on over a weekend. It came about due to a need for a simple way to have audio clips that corresponded to physical materials in the game environment while working on Oiseau. We needed to be able to able to have a different sound for walking/landing on sand than wood, for example. This is a fairly common use case, so I thought it would be an interesting diversion to write a simple open source utility to accomplish this.

It makes use of Unity's existing Physics Materials, a system that integrates with Unity's 2D & 3D physics systems to allow developers to configure physical properties for specific surfaces, such as how bouncy they are or how much friction they have. This utility allows the user to build up sound dictionaries that have entries corresponding to different physics materials, for example a sound dictionary called "Player Landing Sounds" could contain entries for wood, sand and ice, each containing several possible sounds. The dictionaries also contain helpful functions within them to make it easy to play the correct sound within your code.


Recent Posts

See All