One-click to expand All components on the Inspector panel of Unity

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.