# Unity: FMOD Reference Updater takes 15minutes to scan

**URL:** <https://qa.fmod.com/t/unity-fmod-reference-updater-takes-15minutes-to-scan/22119>\
**Category:** Unity\
**Tags:** mac, unity\
**Created:** [September 23, 2024, 4:48pm UTC](https://qa.fmod.com/t/unity-fmod-reference-updater-takes-15minutes-to-scan/22119 "2024-09-23T16:48:50Z")\
**Posts on this page:** 16\
**Page:** 2

<div class="post-metadata">

**Author:** ![Bacall](https://avatars.discourse-cdn.com/v4/letter/b/eb9ed0/32.png) [@Bacall](https://qa.fmod.com/u/Bacall)\
**Post date:** [October 24, 2025, 12:03am UTC](https://qa.fmod.com/t/unity-fmod-reference-updater-takes-15minutes-to-scan/22119/21 "2025-10-24T00:03:19Z")

</div>

Sorry for the late reply. Where can I send a stripped down project? Don’t want to post it publicly. It doesn’t freeze as much, since it’s now very stripped down from what it was, but it still freezes.

Notes:

- Having especially problems with Spine (Unity Asset, 2D Skeletons), for example removing some of their folders and code does make it scan faster. But still freezes on other stuff
- Removing Odin (and some other assets) did nothing.
- Deleting the “Library” folder, to force Unity re-create it when restarting, did work a little (but not really).
- Renaming prefabs does nothing (tried to remove all weird characters).

---

<div class="post-metadata">

**Author:** ![Leah\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/leah_fmod/32/3685_2.png) [@Leah\_FMOD](https://qa.fmod.com/u/Leah_FMOD)\
**Post date:** [October 24, 2025, 3:24am UTC](https://qa.fmod.com/t/unity-fmod-reference-updater-takes-15minutes-to-scan/22119/22 "2025-10-24T03:24:32Z")

</div>

> [@Bacall](#):
>
> Sorry for the late reply. Where can I send a stripped down project? Don’t want to post it publicly.

No problem! You can upload it to the [Uploads tab of your FMOD profile](https://www.fmod.com/profile#uploads), which only yourself and FMOD staff have access to.

---

<div class="post-metadata">

**Author:** ![Bacall](https://avatars.discourse-cdn.com/v4/letter/b/eb9ed0/32.png) [@Bacall](https://qa.fmod.com/u/Bacall)\
**Post date:** [October 27, 2025, 5:01am UTC](https://qa.fmod.com/t/unity-fmod-reference-updater-takes-15minutes-to-scan/22119/23 "2025-10-27T05:01:40Z")

</div>

I’ve uploaded a project now, both including the FMOD and Unity project.

It’s just a slice of a larger project (uninstalled some plugins and removed as much Scenes, assets and scripts I could). This was the minimum for it to be slow and constantly freeze on prefabs/scenes. Probably possible on smaller projects, but this is the best I could do.

It especially freezes on the NPC and Player prefabs, and Dialogue System plugin (prefabs like BasicUIToolkitDialogueUI.prefab)

Hope this helps

---

<div class="post-metadata">

**Author:** ![Leah\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/leah_fmod/32/3685_2.png) [@Leah\_FMOD](https://qa.fmod.com/u/Leah_FMOD)\
**Post date:** [November 6, 2025, 2:09am UTC](https://qa.fmod.com/t/unity-fmod-reference-updater-takes-15minutes-to-scan/22119/24 "2025-11-06T02:09:25Z")

</div>

Thanks very much for the project! I’ve been able to reproduce exactly what you’ve described, and it should serve as a good reference that we can use to look into improving the Event Reference Updater’s scan time and adding additional options for scan specificity.

---

<div class="post-metadata">

**Author:** ![fiftytwo](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/fiftytwo/32/1154_2.png) [@fiftytwo](https://qa.fmod.com/u/fiftytwo)\
**Post date:** [March 31, 2026, 4:55pm UTC](https://qa.fmod.com/t/unity-fmod-reference-updater-takes-15minutes-to-scan/22119/25 "2026-03-31T16:55:51Z")

</div>

In our project it takes much more. I started at about 11 am. It took about 1 hour to scan prefabs. Now it is processing scenes. It is 10 pm. It processed only 2 scenes. But we have about 30 scenes. I guess it will take 7-8 days to complete. I’m using MacBook Pro Apple M1 Max.

---

<div class="post-metadata">

**Author:** ![Leah\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/leah_fmod/32/3685_2.png) [@Leah\_FMOD](https://qa.fmod.com/u/Leah_FMOD)\
**Post date:** [April 8, 2026, 2:45am UTC](https://qa.fmod.com/t/unity-fmod-reference-updater-takes-15minutes-to-scan/22119/26 "2026-04-08T02:45:33Z")

</div>

Thanks for letting us know! While I can’t offer any workarounds at the moment, I can confirm this issue has been scheduled for development.

If possible, could I get you to run this code from earlier in the thread tally the amount of elements that are being scanned? [Unity: FMOD Reference Updater takes 15minutes to scan - #3 by Leah\_FMOD](https://qa.fmod.com/t/unity-fmod-reference-updater-takes-15minutes-to-scan/22119/3)

---

<div class="post-metadata">

**Author:** ![Leah\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/leah_fmod/32/3685_2.png) [@Leah\_FMOD](https://qa.fmod.com/u/Leah_FMOD)\
**Post date:** [April 20, 2026, 4:53am UTC](https://qa.fmod.com/t/unity-fmod-reference-updater-takes-15minutes-to-scan/22119/27 "2026-04-20T04:53:34Z")

</div>

Just following up on this @fiftytwo could I get you to run the code I mentioned in my previous reply so I can get the total number of elements in your project?

---

<div class="post-metadata">

**Author:** ![Ultroman](https://avatars.discourse-cdn.com/v4/letter/u/258eb7/32.png) [@Ultroman](https://qa.fmod.com/u/Ultroman)\
**Post date:** [May 28, 2026, 9:36pm UTC](https://qa.fmod.com/t/unity-fmod-reference-updater-takes-15minutes-to-scan/22119/28 "2026-05-28T21:36:36Z")

</div>

Our project hung during Event Reference Updater, too. I found out why and **fixed it**. Here’s the what and how, with a **full step-by-step guide at the bottom** on how to fix it.

NOTE: I didn’t upload the fully fixed file, as I didn’t want to break any rules or laws, and also this way the fixes are likely to work for many different versions, since they are relatively simple.

## **Issue 1: Editor hangs indefinitely on certain prefabs**

**GetGenericUpdateTasks()** recurses into sub-object fields without any depth limit. On prefabs with components that hold large or self-referential object graphs (e.g. object pools, manager classes with many collection fields), the recursive walk never finishes within a single EditorApplication.update tick, freezing the editor.

### **FIX**

Add a depth guard at the top of **GetGenericUpdateTasks()**. Even going as deep as 8 still makes it ultra-fast. You can change this at your leisure. Whatever you set it to, it no longer continues branching forever.

## **Issue 2: Massive duplicate results and O(n²) cycle detection**

An IEnumerable is used to track visited objects, calling **parents.Contains(value)** for cycle detection, which is incredibly slow! This also only detected direct ancestors in a linear chain, while diamond-shaped references (object A referenced by both B and C) were walked twice. On large graphs this degraded to **O(n²)**.

### **FIX**

Replace the **IEnumerable parents** parameter with a **HashSet** for O(1) lookups, created once per top-level call and shared across all recursive calls.

## **Issue 3: Unmodified prefab instances found in scenes or nested under other prefabs, were reported as duplicate results**

**GetEmitterUpdateTasks()** already correctly skips unoverridden prefab instances by checking **PrefabUtility.GetPropertyModifications()**, but **SearchGameObject()** calls **GetUpdateTasks()**, which routes non-emitter components to **GetGenericUpdateTasks()** which doesn’t check for that. This means every instance of a prefab placed in a scene or under another prefab is fully scanned, even if it has zero overrides, producing duplicate results for every field already reported on the source prefab asset.

### **FIX**

In **SearchGameObject()**, skip any component that is part of a prefab instance with no property modifications on that component.

# **Applying the fixes:**

### Fixing issue 1

We have to add a **depth** parameter to the **GetGenericUpdateTasks()** method, and all the recursive calls within it.

Add the **depth** parameter at the end of the signature, like this…:

```csharp
private static IEnumerable<Task> GetGenericUpdateTasks(object target, string subObjectPath = null, IEnumerable<object> parents = null, int depth = 0)

```

…then add this as the first lines of the method…

```csharp
            if (depth > 8)
                yield break;

```

…then find the recursive calls to it, and add the **depth incrementation**. There are two foreach loops that call it, at the very bottom of the **GetGenericUpdateTasks()** method. Respectively, those lines become:

```csharp
foreach (Task t in GetGenericUpdateTasks(item, FieldPath(subObjectPath, subObjectField.Name, index), parents, depth + 1))

```

and

```csharp
foreach (Task t in GetGenericUpdateTasks(value, FieldPath(subObjectPath, subObjectField.Name), parents, depth + 1))

```

### Fixing issue 2

We need to swap out the **IEnumerable parents** parameter for a **HashSet**. I chose to call it **visitedSet** instead, for clarity.

To optimize the set comparisons, we will add an IEqualityComparer.

Add this somewhere within the **EventReferenceUpdater** class…:

```csharp
        internal sealed class ReferenceEqualityComparer : System.Collections.Generic.IEqualityComparer<object>
        {
            public static readonly ReferenceEqualityComparer Instance = new ReferenceEqualityComparer();
            private ReferenceEqualityComparer() { }
            public new bool Equals(object x, object y) => ReferenceEquals(x, y);
            public int GetHashCode(object obj) => System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(obj);
        }

```

…then go to the signature of **GetGenericUpdateTasks()**, and swap out this…:

```csharp
, IEnumerable<object> parents = null

```

…for this…:

```csharp
, HashSet<object> visitedSet = null

```

…add these lines at the top of the method, right _ **after** _ the **depth** yield we added to fix **Issue 1** …:

```csharp
            if (visitedSet == null)
                visitedSet = new HashSet<object>(ReferenceEqualityComparer.Instance);
            if (!target.GetType().IsValueType && !visitedSet.Add(target))
                yield break;

```

…scroll down a bit, and delete these lines…:

```csharp
                if (parents == null)
                {
                    parents = Enumerable.Empty<object>();
                }

                parents = parents.Append(target);

```

…and lastly replace the remaining references to **parents** with **visitedSet**. There should be two **parents.Contains()** calls and two recursive calls to **GetGenericUpdateTasks()** (the same ones you added **depth + 1** to earlier).

### Fixing issue 3

Find the **SearchGameObject** method, and copy/paste this into the first foreach in it:

```csharp
                // If this component is part of a prefab instance in a scene, skip it unless
                // it actually has overrides. The source prefab asset will be scanned separately.
                if (PrefabUtility.IsPartOfPrefabInstance(behaviour))
                {
                    UnityEngine.Object source = PrefabUtility.GetCorrespondingObjectFromSource(behaviour);
                    PropertyModification[] modifications = PrefabUtility.GetPropertyModifications(behaviour);
                    bool hasOverrides = modifications != null && modifications.Any(m => m.target == source);
                    if (!hasOverrides)
                        continue;
                }

```

TADAAAA! It works, and is super-fast! Spend the saved time enjoying life with your family and being good to yourself.

Best regards, Ultroman the Tacoman

---

<div class="post-metadata">

**Author:** ![Leah\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/leah_fmod/32/3685_2.png) [@Leah\_FMOD](https://qa.fmod.com/u/Leah_FMOD)\
**Post date:** [May 29, 2026, 3:52am UTC](https://qa.fmod.com/t/unity-fmod-reference-updater-takes-15minutes-to-scan/22119/29 "2026-05-29T03:52:56Z")

</div>

Thanks very much for the detailed info on your fixes! I’ll pass this along to the development team.

---

<div class="post-metadata">

**Author:** ![Ultroman](https://avatars.discourse-cdn.com/v4/letter/u/258eb7/32.png) [@Ultroman](https://qa.fmod.com/u/Ultroman)\
**Post date:** [June 3, 2026, 10:13am UTC](https://qa.fmod.com/t/unity-fmod-reference-updater-takes-15minutes-to-scan/22119/30 "2026-06-03T10:13:13Z")

</div>

I forgot to say that all these fixes are to be made in the EventReferenceUpdater.cs file, which is part of the FMODUnity package.

In your Visual Studio solution explorer, navigate to:  
FMODUnityEditor → Assets → Plugins → FMOD → src → Editor → EventReferenceUpdater.cs

The first three parts of the path are of course contingent on where you’ve chosen to import the FMODUnity package. This is the default path.

---

<div class="post-metadata">

**Author:** ![zephyo](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/zephyo/32/9992_2.png) [@zephyo](https://qa.fmod.com/u/zephyo)\
**Post date:** [June 15, 2026, 7:02pm UTC](https://qa.fmod.com/t/unity-fmod-reference-updater-takes-15minutes-to-scan/22119/31 "2026-06-15T19:02:12Z")

</div>

thank u so much it went from 10 minutes and freezing needing to force quit, to like 10 seconds!!

---

<div class="post-metadata">

**Author:** ![Ultroman](https://avatars.discourse-cdn.com/v4/letter/u/258eb7/32.png) [@Ultroman](https://qa.fmod.com/u/Ultroman)\
**Post date:** [June 15, 2026, 8:07pm UTC](https://qa.fmod.com/t/unity-fmod-reference-updater-takes-15minutes-to-scan/22119/32 "2026-06-15T20:07:23Z")

</div>

You’re so welcome! Now it was all worth it 😄

---

<div class="post-metadata">

**Author:** ![capybara](https://avatars.discourse-cdn.com/v4/letter/c/34f0e0/32.png) [@capybara](https://qa.fmod.com/u/capybara)\
**Post date:** [August 7, 2026, 9:18pm UTC](https://qa.fmod.com/t/unity-fmod-reference-updater-takes-15minutes-to-scan/22119/33 "2026-08-07T21:18:10Z")

</div>

Thanks a lot for this. I applied your changes as well and it helped a lot (less than 30 secs now). It was taking a long time before (probably an hour) and most recently I had it running for days. We may have quite a bit of “depth” in our project (not sure why it was going for that long).

In case it’s helpful to the Firelight folks, I typically use this tool if I don’t know the location of a sound trigger within Unity. E.g. I make a small change to the event name and then run this tool to locate it. I’m not sure if there’s a better way to search a Unity project for an FMOD event trigger.

Sean

---

<div class="post-metadata">

**Author:** ![Ultroman](https://avatars.discourse-cdn.com/v4/letter/u/258eb7/32.png) [@Ultroman](https://qa.fmod.com/u/Ultroman)\
**Post date:** [August 8, 2026, 3:27am UTC](https://qa.fmod.com/t/unity-fmod-reference-updater-takes-15minutes-to-scan/22119/34 "2026-08-08T03:27:01Z")

</div>

I’m so glad you got good results with it \<3 Stoked, honestly 😀

I think this is the only way to find triggers.

Your project may not have a lot of depth, but instead circular reference chains, in which case, the original code never finishes, because that’s infinite depth. I had that, because I made a ScriptableObject that was a playlist type of thing with several event references in a list, and a prefab with a MusicPlayer singleton on it, which had a reference to all the possible playlists. I never fully understood why it became a circular reference chain, but I could see on my logs that it kept going through that same playlist. Perhaps the playlist object referenced the MusicPlayer? Idk. Anyway, with the altered code, it just limits it from going infinite.

Hope you save years of time with this 😄

---

<div class="post-metadata">

**Author:** ![Ultroman](https://avatars.discourse-cdn.com/v4/letter/u/258eb7/32.png) [@Ultroman](https://qa.fmod.com/u/Ultroman)\
**Post date:** [October 14, 2026, 11:38am UTC](https://qa.fmod.com/t/unity-fmod-reference-updater-takes-15minutes-to-scan/22119/37 "2026-10-14T11:38:32Z")

</div>

Sadly, I cannot edit my previous post.  
**Note that the previous fixes must be applied first, otherwise the line numbers and code may not match, so apply them in the given order!**

## **Issue 4: Catch ArgumentNullException**

There is an ArgumentNullException, which happens when Unity finds missing scripts on a GameObject in the hierarchy.

### **FIX**

Skip null references.

### **HOW TO DO IT**

In EventReferenceUpdater.SearchForGameObject(), as the first thing inside the loop over the behaviours collection, add this:  
`if (behaviour == null) continue;`

## **Issue 5: Remove duplicate noise from the result list**

This can happen, if a script references a ScriptableObject or a Prefab or another Component, and the referenced object (or a child of it) has a reference to an FMODUnity.EventReference. Since any referenced Object will be handled individually, and you can’t make prefab-overrides to their internal values, there is no reason to even look at them.

**Example:**  
You have a ScriptableObject type called **MyAudioObject** with a reference to an FMODUnity.EventReference, and you have an instance of that called **MyAudioObjectA**. Any ScriptableObject or Prefab or Component that has a reference to **MyAudioObjectA** , will show up in the list when there’s a change to **MyAudioObjectA**. This would make sense, if you could make changes to the ScriptableObject via those references, but you cannot, so we might as well skip them. This also drastically increases performance, if you have many references to UnityEngine.Object types.

### **FIX**

Skip UnityEngine.Object references entirely.

### **HOW TO DO IT**

Around line **715** , find this line:  
`if (value == null || (value is UnityEngine.Object && !(value as UnityEngine.Object)))`

and change it to:  
`if (value == null || value is UnityEngine.Object)`

Around line **752** , find this line:  
`if (item != null && !item.GetType().IsPrimitive && !visitedSet.Contains(item)`

and change it to:  
`if (item != null && !(item is UnityEngine.Object) && !item.GetType().IsPrimitive && !visitedSet.Contains(item)`

---

<div class="post-metadata">

**Author:** ![Leah\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/leah_fmod/32/3685_2.png) [@Leah\_FMOD](https://qa.fmod.com/u/Leah_FMOD)\
**Post date:** [November 5, 2026, 4:41am UTC](https://qa.fmod.com/t/unity-fmod-reference-updater-takes-15minutes-to-scan/22119/38 "2026-11-05T04:41:28Z")

</div>

Just to keep you all up to date on this - improvements to the event reference updater have been implemented and will be present in our next minor release, 2.03.26.

[Previous page](https://qa.fmod.com/t/unity-fmod-reference-updater-takes-15minutes-to-scan/22119.md?page=1)
