I have only seen this happen like three times, so I haven’t managed to drill down into what exactly triggers it, but every so often I will have a build that’s completely missing the fmod bank. Upon digging deeper in the build logs, this is what I found:
ArgumentException: An item with the same key has already been added. Key: tvOS
at System.Collections.Generic.Dictionary`2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) [0x000dd] in <612a2c65aaf843d698f8d38b2ad7654a>:0
at System.Collections.Generic.Dictionary`2[TKey,TValue].Add (TKey key, TValue value) [0x00000] in <612a2c65aaf843d698f8d38b2ad7654a>:0
at FMODUnity.EditorSettings.AddPlatformForBuildTargets (FMODUnity.Platform platform) [0x0001a] in /Volumes/Bulk/jenkins/workspace/tilebreaker-pipeline/tilebreaker-unity/Assets/Plugins/FMOD/src/Editor/EditorSettings.cs:74
at FMODUnity.Settings.LinkPlatform (FMODUnity.Platform platform) [0x00015] in /Volumes/Bulk/jenkins/workspace/tilebreaker-pipeline/tilebreaker-unity/Assets/Plugins/FMOD/src/Settings.cs:446
at FMODUnity.Settings.ForEachPlatform (System.Action`1[T] action) [0x00016] in /Volumes/Bulk/jenkins/workspace/tilebreaker-pipeline/tilebreaker-unity/Assets/Plugins/FMOD/src/Settings.cs:412
at FMODUnity.Settings.OnEnable () [0x00156] in /Volumes/Bulk/jenkins/workspace/tilebreaker-pipeline/tilebreaker-unity/Assets/Plugins/FMOD/src/Settings.cs:631
UnityEngine.ResourcesAPIInternal:Load(String, Type)
UnityEngine.ResourcesAPI:Load(String, Type) (at /Users/bokken/buildslave/unity/build/Runtime/Export/Resources/Resources.bindings.cs:71)
UnityEngine.Resources:Load(String, Type) (at /Users/bokken/buildslave/unity/build/Runtime/Export/Resources/Resources.bindings.cs:122)
UnityEngine.Resources:Load(String) (at /Users/bokken/buildslave/unity/build/Runtime/Export/Resources/Resources.bindings.cs:112)
FMODUnity.Settings:Initialize() (at Assets/Plugins/FMOD/src/Settings.cs:263)
FMODUnity.Settings:get_Instance() (at Assets/Plugins/FMOD/src/Settings.cs:251)
FMODUnity.EditorSettings:CanBuildTarget(BuildTarget, BinaryType, String&) (at Assets/Plugins/FMOD/src/Editor/EditorSettings.cs:431)
FMODUnity.BuildProcessor:OnPreprocessBuild(BuildReport) (at Assets/Plugins/FMOD/src/Editor/EditorSettings.cs:626)
UnityEditor.Build.<>c__DisplayClass16_0:<OnBuildPreProcess>b__1(IPreprocessBuildWithReport) (at /Users/bokken/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs:436)
UnityEditor.Build.BuildPipelineInterfaces:InvokeCallbackInterfacesPair(List`1, Action`1, List`1, Action`1, Boolean) (at /Users/bokken/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs:402)
UnityEditor.Build.BuildPipelineInterfaces:OnBuildPreProcess(BuildReport) (at /Users/bokken/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs:434)
UnityEditor.BuildPipeline:BuildPlayerInternalNoCheck(String[], String, String, BuildTargetGroup, BuildTarget, Int32, BuildOptions, String[], Boolean)
UnityEditor.BuildPipeline:BuildPlayerInternal(String[], String, String, BuildTargetGroup, BuildTarget, Int32, BuildOptions, String[]) (at /Users/bokken/buildslave/unity/build/Editor/Mono/BuildPipeline.bindings.cs:448)
UnityEditor.BuildPipeline:BuildPlayer(String[], String, String, BuildTargetGroup, BuildTarget, Int32, BuildOptions, String[]) (at /Users/bokken/buildslave/unity/build/Editor/Mono/BuildPipeline.bindings.cs:347)
UnityEditor.BuildPipeline:BuildPlayer(BuildPlayerOptions) (at /Users/bokken/buildslave/unity/build/Editor/Mono/BuildPipeline.bindings.cs:321)
AutoBuilder:StandardBuild(BuildTarget, String) (at Assets/Editor/AutoBuilder.cs:80)
AutoBuilder:Build() (at Assets/Editor/AutoBuilder.cs:42)
(Filename: Assets/Plugins/FMOD/src/Settings.cs Line: 263)
So far it’s only happened when doing an Android build, which seems strange considering it’s adding the tvOS platform twice. Either way, this causes execution of the fmod bits to stop, meaning the bank never makes it into the build. Strangely, this does not throw a big enough error to actually stop the build (though that is possibly on me?).
Re-running the build without any changes fixes the issue. The game runs perfectly well in editor.
It’s possible this is being triggered by building for iOS first, then android, but I can’t reproduce it that way, so maybe not.
I’m running Unity 2021.3.10f1 and FMOD 2.02.07, builds run headless on a Mac.