Skip to content

Instantly share code, notes, and snippets.

@mwegner
Last active January 12, 2022 14:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mwegner/3d688300ed17409eaf4aedfd468f436a to your computer and use it in GitHub Desktop.
Save mwegner/3d688300ed17409eaf4aedfd468f436a to your computer and use it in GitHub Desktop.
Potential fix for Intel Unity Editor crashes on Apple Silicon hardware
/*
If you see Intel Unity Editor crashes on Apple Silicon hardware that look like this:
Thread 0 Crashed:: tid_103 Dispatch queue: com.apple.main-thread
0 ??? 0x7ff894e4a940 ???
1 libsystem_kernel.dylib 0x7ff804893506 __psynch_cvwait + 10
2 libmonobdwgc-2.0.dylib 0x15dbb2aff mono_os_event_wait_multiple + 556
3 libmonobdwgc-2.0.dylib 0x15dbb28cd mono_os_event_wait_one + 38
4 libmonobdwgc-2.0.dylib 0x15dbc35a4 mono_thread_info_wait_one_handle + 13
5 libmonobdwgc-2.0.dylib 0x15dae3298 mono_domain_try_unload + 576
6 libmonobdwgc-2.0.dylib 0x15daddd87 mono_unity_domain_unload + 27
7 Unity 0x106299ae6 UnloadDomain() + 182
This editor script might fix you up. It did for me. Place it under any Editor/ folder in your project
I have no idea which of the two is responsible, or how little you could safely sleep, but I don't want to know
Wrapped in defines to avoid slowing down windows teammates for no reason
@mwegner
*/
#if UNITY_EDITOR_OSX
using System.Threading;
using UnityEditor;
using UnityEditor.Compilation;
[InitializeOnLoad]
public class AppleSiliconCompileFix
{
static AppleSiliconCompileFix()
{
AssemblyReloadEvents.beforeAssemblyReload += delegate
{
Thread.Sleep(500);
};
CompilationPipeline.compilationStarted += delegate(object o)
{
Thread.Sleep(500);
};
}
}
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment