From c336c09f4b925e0876c1b8c08bcc2aacdf2201d8 Mon Sep 17 00:00:00 2001 From: alexiscatnip Date: Wed, 3 Aug 2022 23:56:06 +0800 Subject: [PATCH] bugfix: fix MTDispatcher --- .../Plugins/CommonDependencies/UnityMainThreadDispatcher.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Assets/Plugins/CommonDependencies/UnityMainThreadDispatcher.cs b/Assets/Plugins/CommonDependencies/UnityMainThreadDispatcher.cs index 96d72a0..b61f442 100644 --- a/Assets/Plugins/CommonDependencies/UnityMainThreadDispatcher.cs +++ b/Assets/Plugins/CommonDependencies/UnityMainThreadDispatcher.cs @@ -138,7 +138,11 @@ public class UnityMainThreadDispatcher : MonoBehaviour void OnDestroy() { - _instance = null; + //only perform clean-up for myself. + if (_instance == this) + { + _instance = null; + } } public static Thread GMainThread;