DEV Community

Fabian Fabro
Fabian Fabro

Posted on • Edited on

Setting up an FMOD Project + Unity for Collaboration (Git)

This blog post is based on FMOD ver. 2.1

So I just participated in this year's annual Global Game Jam. This marks my 4th year in this specific jam (besides doing other in between jams over the year).

My first 2 years, I would take on the role as a composer/sound designer. These past 2 years, since getting into software development, I've been aiming towards wanting to do my technical sound design and audio implementation.

Okay, enough backstory about myself, let's get to the topic!

Topics

  • Gitignore
  • Source Control
  • Build Files
  • Other Resources

Setting up the Gitignore

For many collaborations I've worked in, most programmers have complained how much Git behaves with Unity. Git is notorious with working with Unity. This is also based on my personal endeavors with Git and Unity as well. I'm super glad to finally have found the template to handle FMOD's files into Unity for Git.

Here is the Gitignore template:
Reference from Paalo's post in the FMOD Forums



### FMOD Unity Integration ###
# Never ignore DLLs in the FMOD subfolder, so make sure that the 
# FMOD-folder is in the correct path.
!/[Aa]ssets/Plugins/FMOD/**/*.dll

# Don't ignore images and gizmos used by FMOD in the Unity Editor
!/[Aa}ssets/Gizmos/FMOD/*
!/[Aa}ssets/Editor Default Resources/FMOD/*

# Ignore the Cache-file since it is updated locally either way
/[Aa]ssets/**/FMODStudioCache.asset
/[Aa]ssets/**/FMODStudioCache.asset.meta
/[Aa]ssets/Plugins/FMOD/Cache.meta
/[Aa]ssets/Plugins/FMOD/Cache/Editor.meta

# Log-files
fmod.log
fmod_editor.log

# FMOD 1.10.x (Legacy)
/Assets/FMODAssets/*
/Assets/FMODStudioCache.meta


Enter fullscreen mode Exit fullscreen mode

With web development, Git is nice with because of the size of files. When it comes to Unity, Unreal Engine, or other game engine, it's a tricky story because now we are dealing with an LFS (Large File Storage) territory. That's for a whole other topic, I've had some failures from a past game jam collaboration trying to incorporate LFS. You can give it a try here.

Audio Files are no joke because we mostly work with .wav & .ogg format. And .wav files can get pretty big, especially in music when dealing with instrumentation, time length, sound libraries, etc.

Personally, I use .wav when I compose music or sound design in my DAW. Except if I'm using Wwise, I'll still work with .wav, but compress the files into .ogg in Wwise, for compressing file size, but that's going a bit off tangent.

This may differ for other people's setup, when our team was setting up the game project for a Git repo, we had 2 gitignore files. One gitignore was on the outside folder from the Unity Folder, and the other in the actual Unity project folder. I would just copy this FMOD template in both gitignores just in case.

Source Control

When using the Git Terminal, the most common commands to utilize is:

This will add all files you want to be pushed to the repo



git add .


Enter fullscreen mode Exit fullscreen mode

You can customize your message, that will be seen on the repo, best to add a message that relates to your latest progress you made



git commit -m "add commit message here"


Enter fullscreen mode Exit fullscreen mode

You are grabbing the files from the repo in case other collaborators pushed their files and changes.



git pull


Enter fullscreen mode Exit fullscreen mode

You push up your files and changes.



git push 


Enter fullscreen mode Exit fullscreen mode

When collaborating with others, it's safer to git pull before git push in order to avoid less merge conflicts (which will happen, it WILL HAPPEN).

=============
3/15/21 Edited



git reset --hard <commit code number> //


Enter fullscreen mode Exit fullscreen mode

The commit code number usually looks like a string of random letters and numbers like this (without the < > surrounding):
64f31ej5q1684028501w1389ui67nv2z745h7234

Which can be found in the git repo, That's what those git commit messages are for!

Git reset is used to revert back to a previous commit, or previous version if you find yourself messing up on your current progress.

=============

Just based on experience, the other collaborators will somehow get some meta or cache FMOD files from your pushes. Your FMOD project is the main one that you will be merging anyway to resolve since you are in charge of making changes to those FMOD files.

Build Files

Creating the export files differs on which route you take on how you import them into your Unity project. It's listed in the FMOD Documentation here: Accessing Your FMOD Studio Content

Which they do a wonderful job explaining it, but I can try to add on my experience as well.

So in Unity (after installing FMOD into your project), on the top menu, go to:
FMOD -> Edit Settings

And inspector should open FMODStudioSettings

FMOD Studio Settings

There are three ways on how you want to share your FMOD files into the collaboration space.

  1. Project
  2. Single Platform Build
  3. Multiple Platform Build

Project: This way, you can drag your whole FMOD Project Folder and add it into your Assets Folder in Unity (to be in the folder level next to scripts folder, prefabs folder, scenes folder, etc.)

Looking for the .fspro project file.

This would probably be used if you are collaborating with multiple game audio members who need access to FMOD project, because you are essentially adding the whole project folder into the Unity folder. This also means that there might be complications with the other non-audio members that don't want to deal with merge conflicts of accidentally altering any files with FMOD, whether it could be from hidden meta or cache files.

Single Platform Build: This way is instead of bringing your whole FMOD Project folder into the Unity Assets Folder, you just need to bring in the bank files you generated from FMOD. In case you're not sure how to generate the bank files:

File -> Build

File Build

It should have generated these files.

Build Files

When you have installed FMOD to your Unity Project already, you should have two folders called "Gizmos" & "Plugins" generated in the Unity Main Assets folder:

Unity Assets

Gizmos carries the an FMODEmitter file, while the Plugins carries the cache data.

You can create a new folder in the Unity Assets Folder, calling it "FMOD Banks" (feel free to name it the way you want, as long as you negotiate to your collaborators for file/folder name conventions) for organizational purpose.

For me, I dragged the FMOD Master.bank & Master.strings.bank files into the FMOD Banks folder. I created the FMOD Banks folder in Gizmos (you don't have to only place it there). I would have probably just place FMOD Banks Folder in the main Assets Folder.

You can also set up an automation location of where you want your FMOD builds to generate.

Preferences -> Build Tab -> Browse where you want to generate the build files

In this case, you would place them into your FMOD Banks folder in your Unity Assets.

Preference

Build Export

Multiple Platform Build: This way is when importing from multiple sub directories. Personally, I have not used this yet because I have not built a game in this scope yet. However, in the FMOD documentation, its use is when you want to use separate .Bank files for separate builds based on each platform (console, PC, Mac, mobile, etc.).

The main goal is having the files in the Unity Project folder in order to keep it in scope of where the Git Repo is located.

I've been curious about looking at alternatives of Git with Game development. I've been suggested Perforce, which I'll probably look into the future since I've heard that is AAA studio standard. I think it's because Git is open source and easily accessible to a wide audience, which commonly most people go to for source control.

My way of working with FMOD may not fit for everyone, feel free to add your workflow with it. I'm mainly sharing my experience that I've had a rough time before with dealing with setups for collaborations but now finding something that actually worked for me.

I just hope this helps with game audio folks getting into collaborative projects.

Here are more resources for things discussed in this blog.

Gitignore

How to use gitignore file

Git LFS (Large File Storage)

Getting Started in FMOD

Perforce

Top comments (0)