Unity Character Foley System

 
Character Foley System.png

Version 1.0

This is a free open source project that is available to download through Bitbucket.

Features Include:

- Surface automation for both terrain and game objects.

- Inspector audio preview.

- Heel and toe speed automation.

- Randomise audio modulation.

- Nuisance controller.

- Surface audio layering.

- Multiple triggering methods.

- Full mix control.

- Wet to dry control.

- Add your own sounds.

Git Clone Project Link:

Copy the link below to your version control software (e.g. SourceTree) to download the current project and track its improvements, updates and new features as they are added and become available.

git clone https://daracrawford@bitbucket.org/daracrawford/unity-character-foley-system.git

Alternatively you can download the project directly from BitBucket by clicking on the button below.

 

Video Walkthrough Covering All Core Features

 

Feature Summary

Surface automation for both terrain and game objects

Set the interval for surface checking for both game objects and terrain. There are two prefabs that will need to be tweaked to your liking, one is on the Raycast Surface surface prefab, with the component script of the same name. The other is Foley Trigger script component which should be placed onto the player character.

sY4yPPfli0PEMdoRKwSUX8g.png
 

Inspector audio preview

On the Character Sounds prefab there are two child objects, one named Footsteps and the other Clothing & Equipment. These two game objects allow you to preview how the character will sound when walking on different surfaces, as well as how they’ll sound with the selected clothing and accessories.

slDPlqtgbZqXCvUuN9tSJkw.png
 

Heel and toe automation

The heel-toe automation feature simply creates a natural movement sound by adapting to the player’s movement speed.  Various statements are called depending on the actual player speed. See illustration below for a graphic representation.

imageLikeEmbed.jpg

In the above graph, the vertical axis has been converted to a range of 0 to 100 in a bid to make it easier to illustrate what’s happening.  In essence, as the character increases in speed, the footstep volume is increased, while the toe delay is decreased. When the character is in the state of running, the toe delay is completely removed, this is not visible in the illustration, as it is only accounting for the added delay, and not the default delay of the toe playing after the heel.

 

Audio modulation

The audio modulation performs random adjustments to the volume, pitch and filters. The ease of which audio modulation can be accomplished in audio middleware is one of its key features, in this project it was important to offer a similar feature, therefore a series of methods for volume, pitch and filters were designed that could modulate these parameters by a random amount set by the user. See below for details on how this operates.

s0eiJV_Vys_T27yyuiBQZHg.png
The modules can be activated/de-activated from the inspector, when activated a new slider appears allowing you to set the amount of random modulation.

The modules can be activated/de-activated from the inspector, when activated a new slider appears allowing you to set the amount of random modulation.

 

Nuisance controller

The volume will remain at this amount until the character hits a new surface. When the character does enter a new surface, the volume will jump back to its default value. The reasoning behind this feature was to mitigate the repetitiveness of the footsteps and bringing them down to a value that softens their impact, when the character hits a new surface, the volume jumps back to default informing the player that the surface has changed.

The nuisance controller was influenced by the video game Limbo (Play Dead, 2010) and a blog post from Jacobsen, B (2018).  In the video game Limbo, while the character is moving, the amplitude gradually decreases, and when the character is stationary, the amplitude resets to its default value.  A part of this technique has been applied to this Foley system, as the character walks, the volume will decrease until it reaches the target amplitude set by you from the inspector.  

The base volume is set to 0.8. With the nuisance controller set to 0.6, this is the volume the base level will eventually end up on. The speed to target subtracts from its value from the base volume until the target volume has been reached.

The base volume is set to 0.8. With the nuisance controller set to 0.6, this is the volume the base level will eventually end up on. The speed to target subtracts from its value from the base volume until the target volume has been reached.

 

Surface audio layering

To create more complexity to the surfaces, it’s possible to drag prefabs into the scene which represent shattered glass, water movement, puddles, wood creeks and foliage.  See below for details.

When the character enters one of these triggers, it will automatically trigger and sync an extra surface layer, this includes foliage, glass, puddles, wood creeks and water movement.

When the character enters one of these triggers, it will automatically trigger and sync an extra surface layer, this includes foliage, glass, puddles, wood creeks and water movement.

 

Multiple triggering methods

The Foley event trigger script is responsible for calling all methods relating to footstep and equipment, each time the character takes a step multiple methods can be called and synced to a character’s locomotion.  It also manages the surface switches as well as the interval for how frequent it should check the terrain surface. It’s important to note that it only checks the surface when the game object tag is set to equal “Terrain”.  See the following illustration for a breakdown of how it operates.

When applying to your own project, ensure to correctly sync the Foley surface terrain triggers with the Unity terrain system as shown above. It’s also possible to set the interval time for checking the terrain surface. This is also possible on the  “Raycast_SurfaceCheck”  prefab for game object surface checking.

When applying to your own project, ensure to correctly sync the Foley surface terrain triggers with the Unity terrain system as shown above. It’s also possible to set the interval time for checking the terrain surface. This is also possible on the “Raycast_SurfaceCheck” prefab for game object surface checking.

 

Full mix control

Unity has an extensive mixer that can be used to individually mix audio clips, group clips, and also control effects like reverb, compression and limiters etc. Therefore it made sense to utilise its potential for management over the various surfaces, clothing and equipment sounds.

All surfaces are grouped under the Footsteps group, while all clothing materials are grouped under clothing, and accessories grouped under equipment. All these groups can be controlled via the master group called Foley Master. This makes it much easier to balance and mix the character Foley sounds together.

All surfaces are grouped under the Footsteps group, while all clothing materials are grouped under clothing, and accessories grouped under equipment. All these groups can be controlled via the master group called Foley Master. This makes it much easier to balance and mix the character Foley sounds together.

 

Wet to dry control

This script component enables you to control the speed of which the character will dry, there are two audio bus variables, one for wet clothes the another for feet.  As the character enters water, these water buses become enabled, and will deduct from the volume in delta time, which is time taken between frames. The character dry variable shown below is a multiplier, when it increases, it multiplies the output of delta time, giving a quicker response time on how quickly the character dries and vice versa.  

This component should be applied to all water surfaces in your game. If it’s a large pool of water then the Character Dry Speed should be set lower, this will lengthen the time it takes for the wet sounds to stop.

This component should be applied to all water surfaces in your game. If it’s a large pool of water then the Character Dry Speed should be set lower, this will lengthen the time it takes for the wet sounds to stop.

 

Add your own sounds

Inside the DC assets folder, there are scriptable game objects representing surfaces, clothing and equipment. Inside these objects contain the audio clips, these can be easily replaced by your own where you see fit. All sounds that come with this project have been pre-spatialised, meaning the sound effect is baked into the audio clip, if you want a fuller sound, then this would be a reason to replace the existing audio clips.

The above audio clips can be easily replaced by dragging your own clips into the element slots.

The above audio clips can be easily replaced by dragging your own clips into the element slots.

 

Limitations

  • The nuisance controller currently only works for footsteps.

  • Both heel and toe clips are currently required for the system to function correctly.

  • Current scripts need to be optimised.

 

Current Requested Features For Future Development

  • Global EQ for character weight.

  • Global pitch for character size.

If there are any features / improvement you would like to add to the project, then please get in touch for details on how to merge improvements with the existing build. If you would like to see something added to the requested feature list, then please also feel free to get in touch. To get in touch simply click on contact and fill in the form.