Allister Wylie

Accessibility Designer | Gameplay Designer | Programmer

Tempo Shift | FMOD Integration in Code

Last Updated: 2026-11-29, 2:30:46 p.m.


Jump to:

Intro

Hello! I've been mostly working in engine in early development to reduce strain on our main programmer, so I thought I would give an update on the nightmare that is FMOD and how I approached implementation in-engine.

This won't really help you if you're working in FMOD Studio, as that wasn't really my job, but hopefully it does a decent enough job explaining what I did and some of the issues I encountered.

Also, huge thank you to Alessandro Fama for making a functional guide for FMOD, I don’t know if I could have figured out some of this without it.

Setup

Firstly, make sure whoever is working on your FMOD Studio project (which was not me) is using a Unity verified version and import it into whatever version control your team is using (we use Github). Unfortunately, as FMOD Studio is not my job, I cannot write about making banks or parameters.

Next, set up FMOD for Unity in your project (their in-engine setup guide is pretty comprehensive, so I’ll omit that information). Make sure your FMOD Studio project is attached and banks are built. For our game, one of the banks had a plugin that I couldn't access, so for the time being, I have my load banks settings set to specific banks instead of all of them. A screenshot of the FMOD initialization window with banks selected

Attach an FMOD listener (different to base Unity listeners) to your main camera and everything should mostly be good to go!

Action-based Audio

Oneshot Audio

Oneshot audio was relatively simple, at its base it’s an if check to see if your input has been pressed, and a call for FMODUnity.RuntimeManager.PlayOneShot() if it has been. However, this doesn’t actually kill the channel or the sound and will result in overlapping sounds and a potential memory leak.

In order to solve this, you want a second if statement that checks for an input release and instantly stops and releases the channel.

if (dash.WasPressedThisFrame())
{
FMODUnity.RuntimeManager.PlayOneShot(dashing, transform.position);
}
else if (dash.WasReleasedThisFrame())
{
playerState.stop(FMOD.Studio.STOP_MODE.IMMEDIATE);
playerState.release();
}

Beyond this, it’s basically just writing normal character controller code, like checking if the player is grounded to prevent duplication.

Walking Audio & Troubleshooting

Walking audio ended up being a lot harder to figure out. I had a lot of issues during implementation, either the footsteps would only trigger once (which was actually because it was set to OneShot at first) or they would keep triggering, creating over 100 channels for one sound.

The solution I came up with was creating a playback state in my script, checking to see if the walking audio was still playing before creating an instance. If it wasn’t, it would create an instance and start it. If that instance stopped playing, it would stop and release the instance.

Parameter-based Audio

For our background music, we wanted to set up progressive music based on where the player was in the level. For this, I had to set up gates around our level associated with a number. A screenshot in the Unity editor of our test level with multiple trigger gates

Normally, you could just set up parameter triggers in the inspector, but our player controller doesn’t work with built-in Unity collision detection, so it had to be set up manually.

Luckily, my co-programmer had already figured out a solution for a different feature (our instruction popups). This method uses a raycast to detect these gates, and when it does, it triggers a function that checks the gate’s name, and if it matches an if statement, it changes an int, which is attached to an instance.setParameterByName("Checkpoint", checkNum);, checkNum being the number changed.

A screenshot of raycast code for location detection

This is the raycast code. Once again, very unnecessary if you have normal rigidbody collision. It's basically just looking for an object with the BGMParam script on it and triggering a function.

A screenshot of the Unity inspector with a script attached to it

The script itself has a section for inserting checkpoints. Each checkpoint has the specific game object attached to the script (ch3 object will have ch3 attached in bgmPrefab, for example)

A screenshot of a line of code that changes the checkpoint parameter to whatever value the player crossed over last

The prefab then changes checkNum to the checkpoint number, then that gets fed into a setParameterByName line.