With Unity 2021.3.16 (and 2021.3.15) I get this error when opening an project with just FMOD imported into it:
Settings instance has not been initialized. Unable to continue build.
UnityEngine.Debug:LogWarning (object)
FMODUnity.RuntimeUtils:DebugLogWarning (string) (at Assets/Plugins/FMOD/src/RuntimeUtils.cs:558)
FMODUnity.EditorSettings:CheckActiveBuildTarget () (at Assets/Plugins/FMOD/src/Editor/EditorSettings.cs:664)
FMODUnity.Settings:OnEnable () (at Assets/Plugins/FMOD/src/Settings.cs:622)
UnityEngine.Resources:Load (string)
FMODUnity.Settings:Initialize () (at Assets/Plugins/FMOD/src/Settings.cs:267)
FMODUnity.EditorUtils:CallStartupMethodsWhenReady () (at Assets/Plugins/FMOD/src/Editor/EditorUtils.cs:439)
UnityEditor.EditorApplication:Internal_CallUpdateFunctions () (at /Users/bokken/build/output/unity/unity/Editor/Mono/EditorApplication.cs:356)
This also breaks our builds on our build machine most of the time which is obviously really frustrating!
I’ve tried to diagnose why this is happening, currently my best conclusion is that this is caused by trying to call Resources.Load on something that is currently in the process of being loaded (i.e. from OnEnable). This happens because CanBuildTarget fails if Settings.Instance is null.
Steps to reproduce:
- Import fmodstudio20211.unitypackage into an empty Unity project
- Notice the errors
- Restart Unity
- Notice the errors
The builds have failing fail with the same error but a variety of call stacks, but this doesn’t appear to be reproducible from an empty project (even with an FMOD bank setup).
BuildFailedException: Settings instance has not been initialized. Unable to continue build.
at FMODUnity.EditorSettings+BuildProcessor.OnPreprocessBuild (UnityEditor.Build.Reporting.BuildReport report) [0x00054] in /Users/build/buildAgent/work/99ab41247e8a53b7_Android/Assets/Plugins/FMOD/src/Editor/EditorSettings.cs:641
at UnityEditor.Build.BuildPipelineInterfaces+<>c__DisplayClass16_0.<OnBuildPreProcess>b__1 (UnityEditor.Build.IPreprocessBuildWithReport bpp) [0x00000] in /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs:436
at UnityEditor.Build.BuildPipelineInterfaces.InvokeCallbackInterfacesPair[T1,T2] (System.Collections.Generic.List`1[T] oneInterfaces, System.Action`1[T] invocationOne, System.Collections.Generic.List`1[T] twoInterfaces, System.Action`1[T] invocationTwo, System.Boolean exitOnFailure) [0x000ff] in /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs:402
UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object)
UnityEngine.DebugLogHandler:LogException(Exception, Object)
UnityEngine.Logger:LogException(Exception, Object)
UnityEngine.Debug:LogException(Exception)
UnityEditor.Build.BuildPipelineInterfaces:InvokeCallbackInterfacesPair(List`1, Action`1, List`1, Action`1, Boolean) (at /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs:415)
UnityEditor.Build.BuildPipelineInterfaces:OnBuildPreProcess(BuildReport) (at /Users/bokken/build/output/unity/unity/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/build/output/unity/unity/Editor/Mono/BuildPipeline.bindings.cs:449)
UnityEditor.BuildPipeline:BuildPlayer(String[], String, String, BuildTargetGroup, BuildTarget, Int32, BuildOptions, String[]) (at /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline.bindings.cs:348)
UnityEditor.BuildPipeline:BuildPlayer(BuildPlayerOptions) (at /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline.bindings.cs:322)
UnityEditor.BuildPipeline:BuildPlayer(String[], String, BuildTarget, BuildOptions) (at /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline.bindings.cs:317)
AndroidBuild:Build(String, String, Int32, Boolean, Boolean, Boolean, Boolean) (at Assets/Scripts/Editor/Build/AndroidBuild.cs:109)
BuildSystem:BuildGame(BuildFormFactor) (at Assets/Scripts/Editor/Build/BuildSystem.cs:55)
BuildSystem:BuildFromEnvironmentVariables() (at Assets/Scripts/Editor/Build/BuildSystem.cs:23)