# FMOD: Cleaning up duplicate platform warning

**URL:** <https://qa.fmod.com/t/fmod-cleaning-up-duplicate-platform-warning/16646>\
**Category:** Unity\
**Tags:** unity\
**Created:** [January 14, 2021, 11:49pm UTC](https://qa.fmod.com/t/fmod-cleaning-up-duplicate-platform-warning/16646 "2021-01-14T23:49:02Z")\
**Posts on this page:** 13\
**Page:** 2

<div class="post-metadata">

**Author:** ![VoodooDetective](https://avatars.discourse-cdn.com/v4/letter/v/ecc23a/32.png) [@VoodooDetective](https://qa.fmod.com/u/VoodooDetective)\
**Post date:** [April 19, 2021, 6:49pm UTC](https://qa.fmod.com/t/fmod-cleaning-up-duplicate-platform-warning/16646/21 "2021-04-19T18:49:49Z")

</div>

bump

---

<div class="post-metadata">

**Author:** ![VoodooDetective](https://avatars.discourse-cdn.com/v4/letter/v/ecc23a/32.png) [@VoodooDetective](https://qa.fmod.com/u/VoodooDetective)\
**Post date:** [April 21, 2021, 9:11pm UTC](https://qa.fmod.com/t/fmod-cleaning-up-duplicate-platform-warning/16646/22 "2021-04-21T21:11:01Z")

</div>

bump

---

<div class="post-metadata">

**Author:** ![ben\_fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/ben_fmod/32/1452_2.png) [@ben\_fmod](https://qa.fmod.com/u/ben_fmod)\
**Post date:** [April 26, 2021, 5:49am UTC](https://qa.fmod.com/t/fmod-cleaning-up-duplicate-platform-warning/16646/23 "2021-04-26T05:49:30Z")

</div>

Apologies for the long delay on this issue, and thanks very much for taking the time to send us the reproduction project. After digging into it, I can see that `Settings.OnEnable()` is being called on an object that is already initialized, which is unexpected. This seems to be caused by the combination of two things:

- The Actor Name Enforcer script on the Test prefab has an `OnValidate()` method that modifies the prefab.
- The GUID used by `FMODStudioSettings.asset` is broken somehow (changing the GUID in `FMODStudioSettings.asset.meta` makes the problem go away).

Since I don’t have access to the Unity source code, I can only speculate on the reason for Unity calling `Settings.OnEnable()` unexpectedly in this situation. I suspect that the `OnValidate()` method modifying the prefab marks it as dirty, triggering a reimport cycle that the Settings object gets caught up in because its GUID collides with that of some internal Unity object.

Regardless of the exact cause, we have implemented a fix that ignores any `Settings.OnEnable()` calls on objects that are already initialized. This fix will be in the next release, or I can send you an updated `Settings.cs` file if you prefer.

---

<div class="post-metadata">

**Author:** ![VoodooDetective](https://avatars.discourse-cdn.com/v4/letter/v/ecc23a/32.png) [@VoodooDetective](https://qa.fmod.com/u/VoodooDetective)\
**Post date:** [April 27, 2021, 1:44am UTC](https://qa.fmod.com/t/fmod-cleaning-up-duplicate-platform-warning/16646/24 "2021-04-27T01:44:11Z")

</div>

Oh that’s fantastic! I’d surely appreciate and updated Settings.cs! I’ll also be on the lookout for the latest version. Would that be 09?

Thanks very much for taking a look at this, I really appreciate it!

---

<div class="post-metadata">

**Author:** ![ben\_fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/ben_fmod/32/1452_2.png) [@ben\_fmod](https://qa.fmod.com/u/ben_fmod)\
**Post date:** [April 28, 2021, 3:22am UTC](https://qa.fmod.com/t/fmod-cleaning-up-duplicate-platform-warning/16646/25 "2021-04-28T03:22:43Z")

</div>

The fix will be in the 2.01.10 release. I’ve attached [Settings.txt](https://qa.fmod.com/uploads/short-url/wNIlVP1sNWHK4dyUyrTbFOm8CYy.txt) (51.1 KB) - just rename it to `Settings.cs`, put it in your project, and hopefully it will resolve the problem for you!

Thanks again, and please let us know if you have any further issues.

---

<div class="post-metadata">

**Author:** ![VoodooDetective](https://avatars.discourse-cdn.com/v4/letter/v/ecc23a/32.png) [@VoodooDetective](https://qa.fmod.com/u/VoodooDetective)\
**Post date:** [April 29, 2021, 7:41pm UTC](https://qa.fmod.com/t/fmod-cleaning-up-duplicate-platform-warning/16646/26 "2021-04-29T19:41:10Z")

</div>

Awesome, thanks! I’ll be testing it out. Thanks for digging into this.

---

<div class="post-metadata">

**Author:** ![DmitriyK](https://avatars.discourse-cdn.com/v4/letter/d/d07c76/32.png) [@DmitriyK](https://qa.fmod.com/u/DmitriyK)\
**Post date:** [December 8, 2021, 10:18pm UTC](https://qa.fmod.com/t/fmod-cleaning-up-duplicate-platform-warning/16646/27 "2021-12-08T22:18:20Z")

</div>

Hello!  
I have encountered similar problem with 2.02.04 integration. Method FMODUnity.Settings.OnEnable() was called multiple times after script recompilation, and strangely, hasLoaded flag was always false. So I got `ArgumentException: An item with the same key has already been added. ` because initialization ran a few times. I found this was caused by another plugin. That plugin was creating assets and calling AssetDatabase.SaveAssets() from static constructor (probably not a very good idea). So, fixing that plugin also fixed error in FMOD.

Also, I get the same exception whenever FMODSettings.asset is changed externally by version control (for example when changes are reverted in SVN). Probably this is because the Settings object gets re-created, and OnEnable runs again, but dictionary PlatformForBuildTarget inside EditorSettings object is not re-created, and is populated already.

Thanks!

---

<div class="post-metadata">

**Author:** ![zanhulme](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/zanhulme/32/5069_2.png) [@zanhulme](https://qa.fmod.com/u/zanhulme)\
**Post date:** [March 22, 2022, 1:02am UTC](https://qa.fmod.com/t/fmod-cleaning-up-duplicate-platform-warning/16646/28 "2022-03-22T01:02:21Z")

</div>

Seconding that I’m having the same issue as DmitryK, also in FMOD 2.02.04, on Unity 2021.2.11f1

---

<div class="post-metadata">

**Author:** ![zanhulme](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/zanhulme/32/5069_2.png) [@zanhulme](https://qa.fmod.com/u/zanhulme)\
**Post date:** [March 22, 2022, 2:01am UTC](https://qa.fmod.com/t/fmod-cleaning-up-duplicate-platform-warning/16646/29 "2022-03-22T02:01:38Z")

</div>

Update: Removing my FMOD integration and reimporting from the Unity Package Manager fixed my issue. I’m not sure if it’s something to do with the fact I updated from an earlier version of FMOD partway through this project, or something else weird, but this seems to have fixed things for now.

---

<div class="post-metadata">

**Author:** ![zanhulme](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/zanhulme/32/5069_2.png) [@zanhulme](https://qa.fmod.com/u/zanhulme)\
**Post date:** [June 3, 2022, 1:01am UTC](https://qa.fmod.com/t/fmod-cleaning-up-duplicate-platform-warning/16646/30 "2022-06-03T01:01:08Z")

</div>

I’m now having this issue again. Same FMOD/Unity versions as before, and after someone modified the FMODStudioSettings.asset in source control, it all went to pot again.

UPDATE: Okay, I have found a new, dumb fix for this, but at least it’s a quick dumb fix. I have no idea why it works, but this worked for me:

-Modify settings.cs in some way  
-Tab back to Unity so it will recompile  
-Revert those changes to settings.cs  
-Get Unity to recompile again  
-Mysteriously fixed???

---

<div class="post-metadata">

**Author:** ![Racot\_A](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/racot_a/32/362_2.png) [@Racot\_A](https://qa.fmod.com/u/Racot_A)\
**Post date:** [July 7, 2022, 6:30pm UTC](https://qa.fmod.com/t/fmod-cleaning-up-duplicate-platform-warning/16646/31 "2022-07-07T18:30:19Z")

</div>

I have these issues too from the 2.01 versions.

---

<div class="post-metadata">

**Author:** ![s9meNiNE](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/s9menine/32/146_2.png) [@s9meNiNE](https://qa.fmod.com/u/s9meNiNE)\
**Post date:** [July 10, 2022, 7:18pm UTC](https://qa.fmod.com/t/fmod-cleaning-up-duplicate-platform-warning/16646/32 "2022-07-10T19:18:30Z")

</div>

Saved my bacon, thank you!!

---

<div class="post-metadata">

**Author:** ![ben\_fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/ben_fmod/32/1452_2.png) [@ben\_fmod](https://qa.fmod.com/u/ben_fmod)\
**Post date:** [August 10, 2022, 12:03am UTC](https://qa.fmod.com/t/fmod-cleaning-up-duplicate-platform-warning/16646/33 "2022-08-10T00:03:03Z")

</div>

Apologies for the delay on this issue. I believe we have a fix, but it will be a while before it is released. In the meantime, you can modify the code yourself if you like:

1. In `Assets/Plugins/FMOD/src/Editor/EditorSettings.cs`, add a `public void Clear()` function so it looks like this:

2. In `Assets/Plugins/FMOD/src/Settings.cs`, find `public interface IEditorSettings` and add `void Clear();` so it looks like this:

3. Still in `Assets/Plugins/FMOD/src/Settings.cs`, find `public void OnEnable()` and add `editorSettings.Clear();` so it looks like this:

[Previous page](https://qa.fmod.com/t/fmod-cleaning-up-duplicate-platform-warning/16646.md?page=1)
