Unity Character Foley System
This is a free open source project that is available to download through Bitbucket.
- 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://email@example.com/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
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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 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.