From 4e651fac97e068c8525e0aaeffce09b0a6f8c49f Mon Sep 17 00:00:00 2001 From: mob-sakai Date: Tue, 21 Sep 2021 16:24:38 +0900 Subject: [PATCH] feat: allow zero for scale --- Scripts/Editor/UIParticleEditor.cs | 11 +---------- Scripts/UIParticle.cs | 19 +++---------------- 2 files changed, 4 insertions(+), 26 deletions(-) diff --git a/Scripts/Editor/UIParticleEditor.cs b/Scripts/Editor/UIParticleEditor.cs index 192167d..0381017 100644 --- a/Scripts/Editor/UIParticleEditor.cs +++ b/Scripts/Editor/UIParticleEditor.cs @@ -238,14 +238,7 @@ 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 { @@ -253,9 +246,7 @@ namespace Coffee.UIExtensions EditorGUILayout.PropertyField(x, s_ContentScale); if (EditorGUI.EndChangeCheck()) { - x.floatValue = Mathf.Max(0.001f, x.floatValue); - y.floatValue = Mathf.Max(0.001f, x.floatValue); - z.floatValue = Mathf.Max(0.001f, x.floatValue); + y.floatValue = z.floatValue = x.floatValue; } } diff --git a/Scripts/UIParticle.cs b/Scripts/UIParticle.cs index c64b629..1166fd4 100755 --- a/Scripts/UIParticle.cs +++ b/Scripts/UIParticle.cs @@ -28,10 +28,7 @@ namespace Coffee.UIExtensions [HideInInspector] [SerializeField] internal bool m_IsTrail = false; [Tooltip("Particle effect scale")] [SerializeField] - float m_Scale = 100; - - [Tooltip("Particle effect scale")] [SerializeField] - private Vector3 m_Scale3D; + private Vector3 m_Scale3D = new Vector3(10, 10, 10); [Tooltip("Animatable material properties. If you want to change the material properties of the ParticleSystem in Animation, enable it.")] [SerializeField] internal AnimatableProperty[] m_AnimatableProperties = new AnimatableProperty[0]; @@ -86,11 +83,7 @@ namespace Coffee.UIExtensions public float scale { get { return m_Scale3D.x; } - set - { - m_Scale = Mathf.Max(0.001f, value); - m_Scale3D = new Vector3(m_Scale, m_Scale, m_Scale); - } + set { m_Scale3D = new Vector3(value, value, value); } } /// @@ -99,13 +92,7 @@ namespace Coffee.UIExtensions public Vector3 scale3D { get { return m_Scale3D; } - set - { - if (m_Scale3D == value) return; - m_Scale3D.x = Mathf.Max(0.001f, value.x); - m_Scale3D.y = Mathf.Max(0.001f, value.y); - m_Scale3D.z = Mathf.Max(0.001f, value.z); - } + set { m_Scale3D = value; } } internal Mesh bakedMesh