From ab9d9aa7b3afcdbdda00004f7af3fd4827aaea54 Mon Sep 17 00:00:00 2001 From: mob-sakai Date: Sun, 27 Sep 2020 15:57:07 +0900 Subject: [PATCH] fix: an error happens during loading scene in editor close #101 --- Packages/UIParticle/Scripts/UIParticle.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Packages/UIParticle/Scripts/UIParticle.cs b/Packages/UIParticle/Scripts/UIParticle.cs index 93d2bab..ef08421 100755 --- a/Packages/UIParticle/Scripts/UIParticle.cs +++ b/Packages/UIParticle/Scripts/UIParticle.cs @@ -411,6 +411,7 @@ private void InitializeIfNeeded() #if UNITY_EDITOR void ISerializationCallbackReceiver.OnBeforeSerialize() { + if (Application.isPlaying) return; InitializeIfNeeded(); } @@ -418,7 +419,8 @@ void ISerializationCallbackReceiver.OnAfterDeserialize() { UnityEditor.EditorApplication.delayCall += () => { - if (this) InitializeIfNeeded(); + if (Application.isPlaying || !this) return; + InitializeIfNeeded(); }; } #endif