From a10042d989dea18ff010bdbe970aa434e2bdf117 Mon Sep 17 00:00:00 2001 From: mob-sakai Date: Thu, 9 Jun 2022 02:19:26 +0900 Subject: [PATCH] fix: always display materials in inspector --- Scripts/Editor/UIParticleEditor.cs | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/Scripts/Editor/UIParticleEditor.cs b/Scripts/Editor/UIParticleEditor.cs index 15480fa..f131bec 100644 --- a/Scripts/Editor/UIParticleEditor.cs +++ b/Scripts/Editor/UIParticleEditor.cs @@ -30,8 +30,7 @@ namespace Coffee.UIExtensions private SerializedProperty _spShrinkByMaterial; private ReorderableList _ro; - private bool _xyzMode; - private bool _showMaterials; + static private bool _xyzMode; private static readonly List s_MaskablePropertyNames = new List { @@ -58,14 +57,11 @@ namespace Coffee.UIExtensions _spIgnoreCanvasScaler = serializedObject.FindProperty("m_IgnoreCanvasScaler"); _spAnimatableProperties = serializedObject.FindProperty("m_AnimatableProperties"); _spShrinkByMaterial = serializedObject.FindProperty("m_ShrinkByMaterial"); - _showMaterials = EditorPrefs.GetBool("Coffee.UIExtensions.UIParticleEditor._showMaterials", true); var sp = serializedObject.FindProperty("m_Particles"); _ro = new ReorderableList(sp.serializedObject, sp, true, true, true, true); _ro.elementHeight = EditorGUIUtility.singleLineHeight * 3 + 4; - _ro.elementHeightCallback = _ => _showMaterials - ? 3 * (EditorGUIUtility.singleLineHeight + 2) - : EditorGUIUtility.singleLineHeight + 2; + _ro.elementHeightCallback = _ => 3 * (EditorGUIUtility.singleLineHeight + 2); _ro.drawElementCallback = (rect, index, active, focused) => { EditorGUI.BeginDisabledGroup(sp.hasMultipleDifferentValues); @@ -73,8 +69,6 @@ namespace Coffee.UIExtensions rect.height = EditorGUIUtility.singleLineHeight; var p = sp.GetArrayElementAtIndex(index); EditorGUI.ObjectField(rect, p, GUIContent.none); - if (!_showMaterials) return; - rect.x += 15; rect.width -= 15; var ps = p.objectReferenceValue as ParticleSystem; @@ -98,9 +92,6 @@ namespace Coffee.UIExtensions #endif EditorGUI.LabelField(new Rect(rect.x, rect.y, 150, rect.height), s_ContentRenderingOrder); - var content = EditorGUIUtility.IconContent(_showMaterials ? "VisibilityOn" : "VisibilityOff"); - _showMaterials = GUI.Toggle(new Rect(rect.width - 55, rect.y, 24, 20), _showMaterials, content, EditorStyles.label); - if (GUI.Button(new Rect(rect.width - 35, rect.y, 60, rect.height), s_ContentRefresh, EditorStyles.miniButton)) { foreach (UIParticle t in targets)