Footstep Materials and Footstep Texture Materials are used to add footstep effects to game objects in your scene.
They are assets in your Unity project and can be created in the Project tab via the context menu.
A Footstep Effect is what happens when a Footstepper component causes a footstep (e.g. through walking). They are set up in a Footstep Material and allow you to add audio clips and prefabs that will be used. Adding multiple audio clips or prefabs will randomly select one of the added audio clips or prefabs for each footstep.
You can set up separate audio clips and prefabs for walk, run, sprint, jump and fall footsteps. Walk, run and sprint footsteps use each other as fallbacks – e.g. if you only define Walk, a run or sprint footstep will use the walk audio clips and prefabs. To prevent that (e.g. if you only want to use audio clips or prefabs when running or sprinting, but not when walking), you need to set the Size of the audio clips or prefabs to 1 and not select any audio clip or prefab (i.e. setting up an empty effect).
Additionally, you can set up custom effects – read more on them further down below.
Adding multiple audio clips will randomly select one of the added audio clips for each footstep. There isn’t much more to do here.
Adding multiple prefabs will randomly select one of the prefabs for each footstep.
Beside the prefab, you have multiple settings for the prefab’s placement and how long it’ll remain in the scene. Using a Footstep Manager allows you to use pooling for prefabs, preventing prefabs from being destroyed and spawned again to improve performance.
Enabling At Hit Position will place the prefab at the position the Footstepper component’s raycast hit the ground – otherwise it’ll use the position of the used foot.
Use Foot Rotation will use the rotation of the used foot – otherwise it’ll use the rotation of the Footstepper‘s game object.
Use Hit Normal will use the angle of the ground that was hit by the raycast, aligning the prefab with the ground. Depending on your prefab’s setup you might want to add a Rotation Offset.
If the prefab uses a Particle System, you can use Stop After to stop emitting particles after the defined time (in seconds). The prefab will be destroyed (or disabled, when using pooling) after the Remove After time (in seconds) – when using a Stop After time above 0, this time will be after the particle’s stopped emitting.
The individual prefabs can also add index-based prefabs, i.e. you can define separate prefabs based on the foot index that is currently used.
This can be used to spawn different prefabs for left and right foot, setting up the default prefab and adding another index prefab for foot index 1.
You can create a new Footstep Material via the context menu in the Project tab: Create > Footstepper > Footstep Material
Footstep Materials are a reusable asset that will be used by your Footstep Source components to add footstep effects to game objects in your scenes. E.g. create different materials for wood, stone, grass and water.
Footstepper uses assets for this to allow you to easily make changes to all game objects that use your footstep effects. You only have to change the effects on the Footstep Material asset to have it affect all game objects that use it.
The Default Effect is used when the Footstepper component causing a footstep doesn’t use an Effect Tag or no matching tag is defined in the material’s Tag Effects.
In short, this is the standard footstep effect of the material.
The footstep effect of the matching Tag is used if the Footstepper defined an Effect Tag. You can use tags to create different effects for e.g. ‘heavy’ and ‘light’ footsteppers. In the demo, this is used to change the footsteps to robot sounds and back to normal sounds.
Tags must be unique, you can’t define effects with the same tag.
You can use tag effects to have different effects for small or large characters in your game, or use them to change the effects based on weather effects, like using wet effects during rain.
Custom effects are available in the Default Effect and Tag Effects of a footstep material. They allow you to define additional effects beside the predefined walk, run, sprint, jump and land effects, e.g. for sliding, stumbling or any other thing that might cause an effect.
A custom effect is identified by it’s defined Custom Name – playing a custom effect via an animation event or script (see this tutorial for details on playing effects) needs to provide the name of the custom effect that should be played. The custom effect with a matching name will be used.
The rest of the custom effect’s setup is just like the regular effects, i.e. defining audio clips and prefabs.
Custom effects can also be defined in Tag Effects, i.e. your small or large characters can even have different custom effects.
Footstep Texture Materials
You can create a new Footstep Texture Material via the context menu in the Project tab: Create > Footstepper > Footstep Texture Material
Footstep Texture Materials are a reusable asset that will be used by Terrain Footstep Source, Tilemap Footstep Source components and the Footstep Manager to find footstep effects based on textures and sprites. You can load the textures used by a terrain using the Load From Terrain field – please note that this will remove any previously added data on the material.
The Footstep Manager will be used as a fallback in case a Terrain Footstep Source didn’t find something matching for the texture. Also, if the Footstepper didn’t find any footstep source, it’ll also fall back to the Footstep Manager to check for a texture or sprite on the game object that was hit by the raycast (via the game object’s Tilemap or Renderer components).
The Texture Data connects Textures, Sprites and (render) Materials to Footstep Materials.
Please note that render materials fall back to texture footsteps if no matching material setup is found. Also, render materials are mainly used by Mesh Footstep Sources that find the footstep based on which material was hit on the mesh.
Similar to the texture data, the UV Data connects Textures and (render) Materials to Footstep Materials, but additionally let you define UV textore coordinate ranges mapped to those footsteps.
This allows you to support texture atlases, linking multiple footsteps to the same texture or material based on the UV texture coordinate that was hit by a footstep raycast. Please note that this is only supported via Mesh Footstep Sources and require using Mesh Colliders on the used mesh.
UV texture coordinates begin at X=0, Y=0 in the lower left corner and end at X=1, Y=1 in the upper right corner. Footsteps are mapped to UV coordinates by defining a min coordinate and a max coordinate, i.e. where the area begins and ends on the texture.
See below for an example of a texture with 4 different areas to map footsteps to.
The blue area’s min coordinate is X=0, Y=0, it’s max coordinate is X=0.5, Y=0.5.
The yellow area’s min coordinate is X=0.5, Y=0, it’s max coordinate is X=1, Y=0.5.
The red area’s min coordinate is X=0, Y=0.5, it’s max coordinate is X=0.5, Y=1.
The green area’s min coordinate is X=0.5, Y=0.5, it’s max coordinate is X=1, Y=1.