diff --git a/Unity-Package/Assets/root/Runtime/Future/Types/FutureSprite.cs b/Unity-Package/Assets/root/Runtime/Future/Types/FutureSprite.cs index f702354..c058ddf 100644 --- a/Unity-Package/Assets/root/Runtime/Future/Types/FutureSprite.cs +++ b/Unity-Package/Assets/root/Runtime/Future/Types/FutureSprite.cs @@ -87,8 +87,8 @@ public static void ReleaseMemorySprite(Sprite sprite, DebugLevel logLevel = Debu } // 'sprite.texture' could be called only from main thread - // checking sprite.IsNull is enough until we are in main thread - if (sprite.IsNull()) + // Unity's == (used by IsNull) throws off the main thread, e.g. from a Reference finalizer + if (ReferenceEquals(sprite, null)) return; UniTask.Post(() => diff --git a/Unity-Package/Assets/root/Runtime/Future/Types/FutureTexture.cs b/Unity-Package/Assets/root/Runtime/Future/Types/FutureTexture.cs index 72d843b..bd97028 100644 --- a/Unity-Package/Assets/root/Runtime/Future/Types/FutureTexture.cs +++ b/Unity-Package/Assets/root/Runtime/Future/Types/FutureTexture.cs @@ -46,7 +46,8 @@ public static void ReleaseMemoryTexture(Texture2D obj, DebugLevel logLevel = Deb UnityEngine.Object.DestroyImmediate(obj); return; } - if (obj.IsNull()) + // Unity's == (used by IsNull) throws off the main thread, e.g. from a Reference finalizer + if (ReferenceEquals(obj, null)) return; UniTask.Post(() =>