# FMOD Event Compiler - a helper tool for Unity

**URL:** <https://qa.fmod.com/t/fmod-event-compiler-a-helper-tool-for-unity/18802>\
**Category:** Unity\
**Tags:** unity, csharp\
**Created:** [May 25, 2022, 4:54pm UTC](https://qa.fmod.com/t/fmod-event-compiler-a-helper-tool-for-unity/18802 "2022-05-25T16:54:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![taylank](https://avatars.discourse-cdn.com/v4/letter/t/8797f3/32.png) [@taylank](https://qa.fmod.com/u/taylank)\
**Post date:** [May 25, 2022, 4:54pm UTC](https://qa.fmod.com/t/fmod-event-compiler-a-helper-tool-for-unity/18802/1 "2022-05-25T16:54:06Z")

</div>

Hello everyone,

I wanted to post this here in case anybody finds it useful. I wrote a little utility tool that converts FMOD event hierarchy into a nested class hierarchy in C# with const fields pointing to event paths.

It allows you to do things like this: `RuntimeManager.PlayOneShot(FMODEvents.UI.CoinLoot);`  
… where CoinLoot is a const that points to this event path: “event:/UI/CoinLoot”

It can also handle mix snapshots.

Link is here: [GitHub - taylank/FMOD-Event-Compiler: An editor tool to generate a helper class that converts FMOD event paths to const properties for easy access in code.](https://github.com/taylank/FMOD-Event-Compiler)  
Open to feedback. 🙂

Here’s an example of generated code:

```auto
public class FMODEvents
{
    public class UI
    {
        public const string Click = "event:/UI/Click";
        public const string Unlock = "event:/UI/Unlock";
        public const string Hover = "event:/UI/Hover";
        public const string Repair = "event:/UI/Repair";
        public const string CoinLoot = "event:/UI/CoinLoot";
        public const string Upgrade = "event:/UI/Upgrade";
    }

    public class Abilities
    {
        public const string RamDash = "event:/Abilities/RamDash";
        public const string Gust = "event:/Abilities/Gust";
        public const string Burst = "event:/Abilities/Burst";
        public const string StinkExhaust = "event:/Abilities/StinkExhaust";
        public const string Repulse = "event:/Abilities/Repulse";
        public const string WeaponChange = "event:/Abilities/WeaponChange";
        public const string RapidFire = "event:/Abilities/RapidFire";
        public const string Dash = "event:/Abilities/Dash";
        public const string Concussive = "event:/Abilities/Concussive";
    } 
    
    .
    .
    .
    .
    

public class FMODSnapshots
{
    public const string UILayer = "snapshot:/UILayer";
    public const string GameOver = "snapshot:/GameOver";
}

```

Cheers

---

<div class="post-metadata">

**Author:** ![tamachan87](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/tamachan87/32/3691_2.png) [@tamachan87](https://qa.fmod.com/u/tamachan87)\
**Post date:** [June 24, 2022, 6:49am UTC](https://qa.fmod.com/t/fmod-event-compiler-a-helper-tool-for-unity/18802/2 "2022-06-24T06:49:57Z")

</div>

Very nice! There’s also a built-in header file generator in the FMOD script examples here:

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/f/f38f41ca415e04871dcbdfcb43107645de34493a.png)

It also uses GUIDs so you don’t need to load the `Master.strings.bank` file if you don’t want to.
