Playing sounds on collision

As we mentioned, the last missing element of our scene so far is the sound the axe makes when it hits something. Now, this may seem like it could be quite complicated, and in fact it can be. For instance, you may want to have different objects sound different when getting hit or even perhaps break and make more noise. While that level of detail is entirely possible in Unity, it is a bit overkill for our simple audio demonstration. Instead, we are going to add audio effects to just the axe by following the exercise here:

  1. Enter the search text axprefab in the search field of the Project window. Select the prefab in the folder so the components are shown in the Inspector window.
  2. Click on the Add Component button ...

Get Game Audio Development with Unity 5.X now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.