Unity Freezes During Compilation

Hi everyone, sometimes when we do changes to our code and unity compiles it just freezes after FMOD’s HandleBeforeAssemblyReload

static EditorUtils()
{
	EditorApplication.update += Update;
	AssemblyReloadEvents.beforeAssemblyReload += HandleBeforeAssemblyReload; <----
	EditorApplication.playModeStateChanged += HandleOnPlayModeChanged;
	EditorApplication.pauseStateChanged += HandleOnPausedModeChanged;
}

This is the last entry in my Editor.log, is this caused by FMOD?

Start importing Assets/Scripts/Audio/AudioManager.cs using Guid(5eff8baf2f76c714abbeca01bc9196f0) Importer(-1,00000000000000000000000000000000)
Done importing asset: 'Assets/Scripts/Audio/AudioManager.cs' (target hash: '6bb0fef94eaf57b32c2801efaa6aeea7') in 0.101558 seconds
AssetDatabase: script compilation time: 0.043452s
- Starting script compilation
- Starting compile Library/ScriptAssemblies/Assembly-CSharp.dll
- Finished compile Library/ScriptAssemblies/Assembly-CSharp.dll in 0,63043 seconds
- Starting compile Library/ScriptAssemblies/Assembly-CSharp-Editor.dll
- Finished compile Library/ScriptAssemblies/Assembly-CSharp-Editor.dll in 0,332747 seconds
- Finished script compilation in 0,991776 seconds
Assets\Scripts\CassettePlayerInterference.cs(9,37): warning CS0108: 'CassettePlayerInterference.particleSystem' hides inherited member 'Component.particleSystem'. Use the new keyword if hiding was intended.
Assets\Scripts\Scene Transition\SceneTransitionTrigger.cs(8,34): warning CS0108: 'SceneTransitionTrigger.collider' hides inherited member 'Component.collider'. Use the new keyword if hiding was intended.
Assets\Scripts\Unit\GhostController.cs(45,31): warning CS0108: 'GhostController.collider' hides inherited member 'Component.collider'. Use the new keyword if hiding was intended.
Assets\Scripts\Unit\PlayerInteractionEffect.cs(5,37): warning CS0108: 'PlayerInteractionEffect.renderer' hides inherited member 'Component.renderer'. Use the new keyword if hiding was intended.
Assets\Scripts\FishController.cs(9,11): warning CS0414: The field 'FishController.myTime' is assigned but its value is never used
Assets\Scripts\Managers & Controllers\Multiplatform\Platforms\Switch\SwitchStorage.cs(18,34): warning CS0414: The field 'SwitchStorage.fileHandle' is assigned but its value is never used
Assets\Scripts\Managers & Controllers\CameraController.cs(29,48): warning CS0414: The field 'CameraController.lookAtSpeed' is assigned but its value is never used
Assets\Scripts\DragRotate.cs(12,28): warning CS0414: The field 'DragRotate.accel' is assigned but its value is never used
Assets\Scripts\MotionTransform.cs(52,10): warning CS0414: The field 'MotionTransform.jumpToEnd' is assigned but its value is never used
Assets\Scripts\UI\Ui System\UiCursor.cs(23,40): warning CS0414: The field 'UiCursor.cursorScale' is assigned but its value is never used
Assets\Scripts\Managers & Controllers\Menus\FishingCanvas.cs(63,76): warning CS0414: The field 'FishingCanvas.rotateCamera' is assigned but its value is never used
Assets\Scripts\GhostCupController.cs(33,10): warning CS0414: The field 'GhostCupController.minigameActive' is assigned but its value is never used
Reloading assemblies after forced synchronous recompile.
Begin MonoManager ReloadAssembly
FMOD Studio: Destroying editor system instance
UnityEngine.StackTraceUtility:ExtractStackTrace ()
UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
UnityEngine.Logger:Log (UnityEngine.LogType,object)
UnityEngine.Debug:Log (object)
FMODUnity.EditorUtils:DestroySystem () (at Assets/Plugins/FMOD/src/Editor/EditorUtils.cs:225)
FMODUnity.EditorUtils:HandleBeforeAssemblyReload () (at Assets/Plugins/FMOD/src/Editor/EditorUtils.cs:170)
UnityEditor.AssemblyReloadEvents:OnBeforeAssemblyReload ()
 
(Filename: Assets/Plugins/FMOD/src/Editor/EditorUtils.cs Line: 225)

Usually only happens when Recompiling after I’ve been inside play mode. I have Recompile After Finished Playing checked inside unity.

This was fixed by adding AssemblyReloadEvents.beforeAssemblyReload += Destroy; to RuntimeManager.cs as shown below. :slight_smile:

FMOD.RESULT Initialize()
{
	#if UNITY_EDITOR
	AssemblyReloadEvents.beforeAssemblyReload += Destroy;
	EditorApplication.playModeStateChanged += HandlePlayModeStateChange;
	#endif // UNITY_EDITOR
	....
}

Thanks for letting us know about this. We have a similar fix coming out in the next release (2.01.09), which should be available soon.

1 Like