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.

Footstepper Setup

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:

  • Enabled
    The footstepper is active and uses both audio clips and prefabs.
  • Disabled
    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 Is Player setting will automatically set the Footstepper as the player of the Footstep Manager (if it exists). This will use the manager’s player distance limitation, only allowing Footsteppers to play footsteps within a defined distance to this Footstepper.

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.

Feet Settings

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.

Speed Settings

Depending on how footsteps are played, the Speed Settings will determine if walk, run or sprint effects will be used.

The Speed Update Type defines when the interal movement speed is calculated. It’ll update either in UpdateLate UpdateFixed Update or not at all (None). You can also set the speed of the footstepper via the Speed property of the component (Vector2, X-axis is horizontal speed, Y-axis is vertical speed). Depending on how your game object is moved, you’ll also want to use a matching speed update type, e.g. when moving via Rigidbody (i.e. physics-based), you should also use Fixed Update here (which is the default).

Enabling Use Speed Check will check the movement speed when using the FootstepWalkFootstepRun 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.

Autoplay Footsteps

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.

Audio Settings

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.

Audio Volumes

This defines the volume the walk, run, sprint, jump, land and custom effect audio clips will be played with.

Raycast Settings

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.

Auto Find

The footstepper will try to find a footstep effect based on textures, sprites or materials if no Footstep Source was found. This will check TilemapMesh Renderer and Renderer components on the game object that was hit by the raycast.

You can enable/disable searching for them separately.

Fallback Effect

You can optionally select a Footstep Material to be used as fallback if no other footstep source was found and the Footstep Manager also didn’t find any matching effect.

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.

Events

Playing footsteps can call your custom functions if you register them with a Footstepper. The event handlers will call your functions whenever the Footstepper plays a footstep.

On Footstep

Requires a parameterless function, e.g.:

On Footstep Detailed

Requires a function with 4 parameters:

  • Transform
    Passes on the used foot’s transform.
  • FootstepEffect
    Passes on the footstep effect that will be used (containing the audio and prefab setup).
  • Vector3
    Passes on the position that was hit by the raycast.
  • Vector3
    Passes on the normal that was hit by the raycast.

A function can e.g. look like this: