Footsteppers are used to let something in your scene use footsteps.
They’re components you add to your characters (game objects), like the player or an NPC. The Footstepper component is responsible for finding a Footstep Source when a footstep is used.
You can add Footsteppers to game objects in your scene using the Component menu or via the Add Component button in the Inspector tab (both while having a game object selected). They can be found in the Footstepper sub-menu. Beside simply adding a component, you can also use Add Footstepper (2D) and Add Footstepper (3D) to add footsteppers set up for 2D or 3D games and an Audio Source.
The Footstepper manages when, where and how a footstep effect is used – for this there are different settings available.
The Mode defines if and which parts of footstep effects are used:
The footstepper is active and uses both audio clips and prefabs.
The footstepper is inactive and doesn’t use any footsteps.
- Only Audio
The footstepper is active and uses only audio clips.
- Only Prefab
The footstepper is active and uses only prefabs.
The Effect Tag is used to play different footstep effects from a Footstep Material. E.g. use it to have different effects for light or heavy characters, or change the effect based on the environment (e.g. when it’s raining). In the demo this is used to switch between robot and normal effects.
The Initial Timeout lets you prevent footsteps for a defined time (in seconds) after the level was loaded (or the game object was spawned). Set it to 0 to not use it.
The Time Between is used to have a minimum time (in seconds) between playing two footstep effects. Set it to 0 to not use it.
The Min Animation Weight is used when using animation events to play footsteps. Use it when you’re playing animations via Blend Trees in Mecanim to prevent multiple animations from firing events. Enable Only Highest Animation Weight to only play the animation with the highest weight (per frame), otherwise all animation events exceeding the Min Animation Weight will be used.
This lets you define the feet of the game object – the feet will be used by raycasting to find the ground below each individual foot. You can define as many feet as you want, so even a centipede can have footsteps.
The component’s game object itself will be used if using feet, or if a footstep should be played for a foot exceeding the defined feet.
Depending on how footsteps are played, the Speed Settings will determine if walk, run or sprint effects will be used.
Enabling Use Speed Check will check the movement speed when using the FootstepWalk, FootstepRun or FootstepSprint functions and prevent using a footstep if the speed doesn’t match.
Using the Footstep functions will determine the the appropriate footstep type based on the movement speed – if disabled, it’ll always use run. Learn more about these functions here.
Enabling Auto Play will automatically play footsteps when the game object is moving. This is e.g. a good setup for first person games that don’t use an actual model for the player.
The movement speed will determine if the walk, run or sprint footstep effect is played, as well as the timeout (in seconds) between footsteps. Learn more about other ways to play footsteps here.
Playing audio clips for the footstep effects requires an Audio Source component.
The Pitch Variation randomly sets the pitch before playing an audio clip, based on the audio source’s initial pitch.
This defines the volume the walk, run, sprint, jump and land audio clips will be played with.
The Footstepper will find the ground below a foot (and with that, the Footstep Source) using a raycast.
The Raycast Mode defines if you’re using it in a 2D or 3D game – select Raycast 3D for a 3D game and Raycast 2D for a 2D game.
The Layer Mask is responsible for which game objects you can find via the raycast. Make sure to select the layers that contain your ground objects (e.g. terrain, stones, props, etc.).
The Ray Distance defines how far down the raycast will go to find the ground.
The Ray Offset adds an offset to the position of the foot (or the component’s game object). Enabling In Foot Space will add the offset in local space of the foot, otherwise in local space of the component’s game object.
Unity’s Scene View, while having a game object with a Footstepper selected, shows a red line for each foot to help you find the correct setup for the raycast. The line will start at the foot’s position (+offset) and end either at the ray distance or the ground that was hit.
The footstepper will try to find a footstep effect based on textures or sprites if no Footstep Source was found. This will check Tilemap and Renderer components on the game object that was hit by the raycast.
You can enable/disable searching for them separately.
The raycast still needs to hit a game object for the fallback to be used. If you enable No Raycast Fallback, the fallback material will be used even if the raycast didn’t hit anything.