I Hear Footstep- Game Dev Series 119

Objective: create footstep by using Animation Event.

In the previous article, we have created single audio system by using AudioManager. Today we are going to play the footstep audio to all of walkable creatures in game.
We will use Animation Event to help us finishing this function.

Footstep script

Create a new script and call it FootstepAudio.
Within this script, we will only need to call the AudioSource to play the footstep audio when the animation is stepping on the ground.

With this script, every gameobject with Animator should also add an AudioSource component into it.
Let’s do this part to Player.

AudioSource setting

Select Sprite gameobject under Player(which is where we control the animation with Animator). Then add an AudioSource component and FootstepAudio script.

Drag the footstep audio file into AudioClip column, then disable Play On Awake.

Once done, we can make the running animation to run with footstep sound.

Animation Event

Open Animation tab of Player(by selecting Sprite gameobject), and select Run animation.
Dragging the timeline marker to where the Player has stepped on the ground, then click Add Event button.

It should look like this.

Now select the event marker, and select the method we created in FootstepAudio script as calling event.

Now we have successfully assigned the footstep sound to the running animation.
Play it and check the result!




A passionate gamer whose goal is to work in video game development.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

HOPR ($HOPR) is getting listed on Coinbase and Coinbase Pro

Optimizing Fog in HDRP- Game Dev Series 163

90s kids thought that this was what programming looked like…

TorchMetrics — PyTorch Metrics built to scale

Holy Grail! — The Experience API for Mobile Apps

district0x Dev Update - July 6th, 2021

News: Nfty DM on Streamr Network

Scraping Web Articles Using NewsAPI in Python

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
S.J. Jason Liu

S.J. Jason Liu

A passionate gamer whose goal is to work in video game development.

More from Medium

Making A 3D Backdrop Using ProBuilder In Unity

Using Decals in Unity

Adding another powerup — Shields

Unity Observers