How to play a short sound file in Unreal Engine

- by

When something happens in our game, we may need to play a sound file. Think of anything from firing a bullet, playing footsteps during a walk, or a sound that is fired as a result of us sliding something open. To play those sorts of files we can use a method called Play Sound At Location. Let me show you how it works.

We need several things to make it happen:

  • a sound file, imported into our project (in WAV format)
  • the world location of where we’d like to play our sound
  • a trigger (any event will do)

Here’s what this looks like in Blueprint:

In this example I’m playing a sound file called Door_Movement. It is triggered by a Do Once node, but any trigger will do. Do Once is nice because it avoids your file being played 60 times a second which is… annoying.

The Play Sound at Location node needs to know where to play the sound, and in my case I’m playing it where my Trigger Volume is located (which is likely where my player is located to hear the sound, having just stepped into said Trigger Volume). To get this location, I need a reference to the object, and a GetWorldLocation node. That’s it!

There are some exciting items on the Play Sound node, like the pitch and volume controls. I’ve used an interesting effect in a Game Maker project once, where the “dying” sound an enemy makes is randomly pitched a tad higher or lower than the basic sound, adding a little variation into a single sound file.

If you enjoy my content, please consider supporting me on Ko-fi. In return you can browse this whole site without any pesky ads! More details here.

Leave a Comment