From b80c3e6c9fdd2a8fb72ff233edb85df2e3dbba3d Mon Sep 17 00:00:00 2001 From: wmltogether Date: Thu, 18 Jan 2024 16:35:57 +0800 Subject: [PATCH] fix: (editor) sometimes crashes when entering play mode If there are particle prefabs created using version 3.x in the project, there is a possibility that the editor may crash when entering Play Mode due to deserialization. --- Scripts/UIParticle.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Scripts/UIParticle.cs b/Scripts/UIParticle.cs index 106a3a7..f8638ae 100644 --- a/Scripts/UIParticle.cs +++ b/Scripts/UIParticle.cs @@ -378,7 +378,7 @@ void ISerializationCallbackReceiver.OnAfterDeserialize() #if UNITY_EDITOR EditorApplication.delayCall += () => { - if (!this || !gameObject || !transform) return; + if (!this || !gameObject || !transform || Application.isPlaying) return; transform.localScale = Vector3.one; m_ResetScaleOnEnable = false; EditorUtility.SetDirty(this);