# Bug with loading .bundle plugins on macOS (and the fix for it)

**URL:** https://qa.fmod.com/t/bug-with-loading-bundle-plugins-on-macos-and-the-fix-for-it/19933
**Category:** Unity
**Tags:** csharp, unity
**Created:** [March 3, 2023, 7:25pm UTC](https://qa.fmod.com/t/bug-with-loading-bundle-plugins-on-macos-and-the-fix-for-it/19933 "2023-03-03T19:25:51Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![malcolminyo](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/malcolminyo/32/4706_2.png) [@malcolminyo](https://qa.fmod.com/u/malcolminyo)
#### Post date: [March 3, 2023, 7:25pm UTC](https://qa.fmod.com/t/bug-with-loading-bundle-plugins-on-macos-and-the-fix-for-it/19933/1 "2023-03-03T19:25:51Z")

</div>

I spent a couple of hours today struggling to get the Steam Audio integration to work with FMOD for Unity. After a fair amount of work, I landed on this error:

 ![Screenshot 2023-03-03 at 10.46.24 AM](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/8/8dd83e60af623d02707bdf377368748ad18c03eb.png)

Basically, I had the plugin file in the correct directory, but for some reason FMOD wasn’t recognizing it and only looking for a .dylib instead of a .bundle.

I did some more digging into the FMOD plugin source code, and I _think_ I found the culprit(s). On about line 78 of `PlatformPlayInEditor.cs` is the following function:

```cs
#if UNITY_EDITOR
        internal override string GetPluginPath(string pluginName)
        {
            string platformsFolder = $"{Application.dataPath}/{RuntimeUtils.PluginBasePath}/platforms";

#if UNITY_EDITOR_WIN && UNITY_EDITOR_64
            return string.Format("{0}/win/lib/x86_64/{1}.dll", platformsFolder, pluginName);
#elif UNITY_EDITOR_WIN
            return string.Format("{0}/win/lib/x86/{1}.dll", platformsFolder, pluginName);
#elif UNITY_EDITOR_OSX
            string pluginPath = string.Format("{0}/mac/lib/{1}.bundle", platformsFolder, pluginName);
            if (System.IO.File.Exists(pluginPath)) // <--- it's a folder/directory, not a file, so this fails!!
            {
                return pluginPath;
            }
            else
            {
                return string.Format("{0}/mac/lib/{1}.dylib", platformsFolder, pluginName);
            }
#elif UNITY_EDITOR_LINUX && UNITY_EDITOR_64
            return string.Format("{0}/linux/lib/x86_64/lib{1}.so", platformsFolder, pluginName);
#elif UNITY_EDITOR_LINUX
            return string.Format("{0}/linux/lib/x86/lib{1}.so", platformsFolder, pluginName);
#endif
        }
#endif

```

line 89 is incorrect. As my added comment notes, for macOS the `.bundle` items are _folders_, not _files_, so `System.IO.File.Exists(pluginPath)` returns `false`, because no _file_ at that path exists. Changing line 89 to `if (System.IO.Directory.Exists(pluginPath))` makes the error go away and my audio play as expected.

The function `GetPluginPath()` on line 74 of `PlatformMac.cs` needs to be changed in the same way, I would assume - change line 77 to `if (System.IO.Directory.Exists(pluginPath))`.

---

<div class="post-metadata">

### Author: ![cameron-fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/cameron-fmod/32/261_2.png) [@cameron-fmod](https://qa.fmod.com/u/cameron-fmod)
#### Post date: [March 8, 2023, 4:19am UTC](https://qa.fmod.com/t/bug-with-loading-bundle-plugins-on-macos-and-the-fix-for-it/19933/2 "2023-03-08T04:19:32Z")

</div>

Thank you for reporting this, the fix for this will be out in the next release.

---

<div class="post-metadata">

### Author: ![malcolminyo](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/malcolminyo/32/4706_2.png) [@malcolminyo](https://qa.fmod.com/u/malcolminyo)
#### Post date: [March 9, 2023, 4:10am UTC](https://qa.fmod.com/t/bug-with-loading-bundle-plugins-on-macos-and-the-fix-for-it/19933/3 "2023-03-09T04:10:18Z")

</div>

Thanks so much! 😃
