Sun Guangdong 2015.12.11
Using unityengine;using system.collections.generic;using system.collections;using unityeditor;using System.reflection;using System; <summary>///Description: All the components of the Inspector Panel,///Author: Sun Guangdong//Todo can also be customized in depth, add two buttons to switch///</summa Ry>//[customeditor (typeof (Transform))] public class Inspectormanagereditor:editor {#region = = = = = = #endregion #region ===unity Event = = = Shortcut key: Ctrl + SHIFT + M/ctrl + SHIFT + Q implementation//Display two buttons that can be clicked [MenuItem ("dajiagame/inspectormanager/all expand Components ...%#&m")] static void Expansion () {var type = typeof (Editorwindow). Assembly.GetType ("Unityeditor.inspectorwindow"); var window = Editorwindow.getwindow (type); FieldInfo info = type. GetField ("M_tracker", BindingFlags.NonPublic | BindingFlags.Instance); Activeeditortracker Tracker = info. GetValue (window) as Activeeditortracker; for (int i = 0; i < tracker.activeEditors.Length; i++) {////can be individually judged by the name of the component to expand or not expand//if (Tracker.activeeditors[i].target. GetType (). Name! = "Newbehaviourscript")//{//Here 1 is unfolded, 0 is combined tracker. SetVisible (i, 1); }}} [MenuItem ("dajiagame/inspectormanager/all components ...%#&n")] static void Shrinkage ( ) {var type = typeof (Editorwindow). Assembly.GetType ("Unityeditor.inspectorwindow"); var window = Editorwindow.getwindow (type); FieldInfo info = type. GetField ("M_tracker", BindingFlags.NonPublic | BindingFlags.Instance); Activeeditortracker Tracker = info. GetValue (window) as Activeeditortracker; for (int i = 0; i < tracker.activeEditors.Length; i++) {//Here 1 is the expansion, 0 is the combination of TRAC Ker. setvisible (i, 0); }} #endregion #region = = = = = = = = = = #endregion}
One-click to expand All components on the Inspector panel of Unity