From 34fb12398b035d7796e5f8adba937822793545fd Mon Sep 17 00:00:00 2001 From: mob-sakai Date: Wed, 12 Feb 2020 16:11:39 +0900 Subject: [PATCH] refactor: remove unused code --- .../Scripts/Editor/UIParticleEditor.cs | 34 ++----------------- 1 file changed, 2 insertions(+), 32 deletions(-) diff --git a/Packages/UIParticle/Scripts/Editor/UIParticleEditor.cs b/Packages/UIParticle/Scripts/Editor/UIParticleEditor.cs index 847ff8f..a0d1b55 100644 --- a/Packages/UIParticle/Scripts/Editor/UIParticleEditor.cs +++ b/Packages/UIParticle/Scripts/Editor/UIParticleEditor.cs @@ -122,11 +122,7 @@ public static void AddMenu(GenericMenu menu, SerializedProperty sp, AnimatedProp static readonly GUIContent s_ContentParticleMaterial = new GUIContent("Particle Material", "The material for rendering particles"); static readonly GUIContent s_ContentTrailMaterial = new GUIContent("Trail Material", "The material for rendering particle trails"); static readonly List s_ParticleSystems = new List(); - static readonly Matrix4x4 s_ArcHandleOffsetMatrix = Matrix4x4.TRS(Vector3.zero, Quaternion.AngleAxis(90f, Vector3.right) * Quaternion.AngleAxis(90f, Vector3.up), Vector3.one); - static readonly Dictionary s_InternalMethods = new Dictionary(); static readonly Color s_GizmoColor = new Color(1f, 0.7f, 0.7f, 0.9f); - static readonly Color s_ShapeGizmoThicknessTint = new Color(0.7f, 0.7f, 0.7f, 1.0f); - static Material s_Material; static readonly List s_MaskablePropertyNames = new List() { @@ -152,14 +148,7 @@ protected override void OnEnable() _spScale = serializedObject.FindProperty("m_Scale"); _spIgnoreParent = serializedObject.FindProperty("m_IgnoreParent"); _spAnimatableProperties = serializedObject.FindProperty("m_AnimatableProperties"); - - if (!s_Material) - { - s_Material = Call(typeof(Material), "GetDefaultMaterial"); - } - _particles = targets.Cast().ToArray(); - _shapeModuleUIs = null; var targetsGos = targets.Cast().Select(x => x.gameObject).ToArray(); @@ -244,10 +233,6 @@ public override void OnInspectorGUI() } - - - - //################################ // Private Members. //################################ @@ -257,24 +242,9 @@ public override void OnInspectorGUI() SerializedProperty _spIgnoreParent; SerializedProperty _spAnimatableProperties; UIParticle[] _particles; - ArcHandle _arcHandle = new ArcHandle(); - BoxBoundsHandle _boxBoundsHandle = new BoxBoundsHandle(); - SphereBoundsHandle _sphereBoundsHandle = new SphereBoundsHandle(); - Mesh _spriteMesh; ShapeModuleUI[] _shapeModuleUIs; ParticleSystemInspector _inspector; - static T Call(Type type, string method, params object[] args) - { - MethodInfo mi; - if (!s_InternalMethods.TryGetValue(method, out mi)) - { - mi = type.GetMethod(method, BindingFlags.Static | BindingFlags.NonPublic); - s_InternalMethods.Add(method, mi); - } - return (T)mi.Invoke(null, args); - } - void OnSceneGUI() { _shapeModuleUIs ??= _inspector?.m_ParticleEffectUI?.m_Emitters?.SelectMany(x => x.m_Modules).OfType()?.ToArray(); @@ -284,8 +254,8 @@ void OnSceneGUI() Action postAction = () => { }; Color origin = ShapeModuleUI.s_GizmoColor.m_Color; Color originDark = ShapeModuleUI.s_GizmoColor.m_Color; - ShapeModuleUI.s_GizmoColor.m_Color = new Color(1f, 0.7f, 0.7f, 0.9f); - ShapeModuleUI.s_GizmoColor.m_OptionalDarkColor = new Color(1f, 0.7f, 0.7f, 0.9f); + ShapeModuleUI.s_GizmoColor.m_Color = s_GizmoColor; + ShapeModuleUI.s_GizmoColor.m_OptionalDarkColor = s_GizmoColor; _particles .Select(x => new { canvas = x.canvas, ps = x.cachedParticleSystem, scale = x.scale })