From 13223b2d747609cf88b424ad590bda7f857b387d Mon Sep 17 00:00:00 2001 From: "ibragimov.i" Date: Thu, 18 Feb 2021 23:28:06 +0300 Subject: [PATCH 1/2] fix: Multiselecting sets all scales to the same value --- Scripts/Editor/UIParticleEditor.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Scripts/Editor/UIParticleEditor.cs b/Scripts/Editor/UIParticleEditor.cs index 0fde1f6..0afe59e 100644 --- a/Scripts/Editor/UIParticleEditor.cs +++ b/Scripts/Editor/UIParticleEditor.cs @@ -260,9 +260,9 @@ namespace Coffee.UIExtensions z.floatValue = y.floatValue = x.floatValue; } - x.floatValue = Mathf.Max(0.001f, x.floatValue); - y.floatValue = Mathf.Max(0.001f, y.floatValue); - z.floatValue = Mathf.Max(0.001f, z.floatValue); + if (x.floatValue < 0.001f) x.floatValue = 0.001f; + if (y.floatValue < 0.001f) y.floatValue = 0.001f; + if (z.floatValue < 0.001f) z.floatValue = 0.001f; EditorGUI.BeginChangeCheck(); showXyz = GUILayout.Toggle(showXyz, s_Content3D, EditorStyles.miniButton, GUILayout.Width(30)); From d9eb91c12013dcb56be145f95fa0f3f76b3e461e Mon Sep 17 00:00:00 2001 From: mob-sakai Date: Fri, 19 Feb 2021 09:57:02 +0900 Subject: [PATCH 2/2] refactor: modify the value when the field is changed --- Scripts/Editor/UIParticleEditor.cs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Scripts/Editor/UIParticleEditor.cs b/Scripts/Editor/UIParticleEditor.cs index 0afe59e..e227145 100644 --- a/Scripts/Editor/UIParticleEditor.cs +++ b/Scripts/Editor/UIParticleEditor.cs @@ -250,20 +250,27 @@ namespace Coffee.UIExtensions EditorGUILayout.BeginHorizontal(); if (showXyz) { + EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(sp); + if (EditorGUI.EndChangeCheck()) + { + x.floatValue = Mathf.Max(0.001f, x.floatValue); + y.floatValue = Mathf.Max(0.001f, y.floatValue); + z.floatValue = Mathf.Max(0.001f, z.floatValue); + } } else { EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(x, s_ContentScale); if (EditorGUI.EndChangeCheck()) - z.floatValue = y.floatValue = x.floatValue; + { + x.floatValue = Mathf.Max(0.001f, x.floatValue); + y.floatValue = Mathf.Max(0.001f, x.floatValue); + z.floatValue = Mathf.Max(0.001f, x.floatValue); + } } - if (x.floatValue < 0.001f) x.floatValue = 0.001f; - if (y.floatValue < 0.001f) y.floatValue = 0.001f; - if (z.floatValue < 0.001f) z.floatValue = 0.001f; - EditorGUI.BeginChangeCheck(); showXyz = GUILayout.Toggle(showXyz, s_Content3D, EditorStyles.miniButton, GUILayout.Width(30)); if (EditorGUI.EndChangeCheck() && !showXyz)