Exemplo n.º 1
0
        private static void ExecuteCustomTool()
        {
            CustomTools.Clear();
            List <Type> types = EditorReflectionToolkit.GetTypesInEditorAssemblies();

            for (int i = 0; i < types.Count; i++)
            {
                MethodInfo[] methods = types[i].GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
                for (int j = 0; j < methods.Length; j++)
                {
                    if (methods[j].IsDefined(typeof(CustomToolAttribute), false))
                    {
                        CustomTools.Add(methods[j]);
                    }
                }
            }
            if (CustomTools.Count <= 0)
            {
                Log.Warning("当前不存在至少一个自定义工具!为任何处于 Editor 文件夹中的类的无参静态函数添加 CustomTool 特性,可将该函数附加至自定义工具菜单!");
            }
            else
            {
                for (int i = 0; i < CustomTools.Count; i++)
                {
                    CustomTools[i].Invoke(null, null);
                }
                Log.Info("已执行 " + CustomTools.Count + " 个自定义工具!");
                CustomTools.Clear();
            }
        }
Exemplo n.º 2
0
        private static void ClearConsole()
        {
            Type       logEntries  = EditorReflectionToolkit.GetTypeInEditorAssemblies("UnityEditor.LogEntries");
            MethodInfo clearMethod = logEntries.GetMethod("Clear", BindingFlags.Static | BindingFlags.Public);

            clearMethod.Invoke(null, null);
        }
Exemplo n.º 3
0
 private void ExpandAllChildren()
 {
     Type type = EditorReflectionToolkit.GetTypeInEditorAssemblies("UnityEditor.SceneHierarchyWindow");
     EditorWindow window = EditorWindow.GetWindow(type);
     MethodInfo method = window.GetType().GetMethod("SetExpandedRecursive", BindingFlags.Public | BindingFlags.Instance);
     int id = Target.gameObject.GetInstanceID();
     method.Invoke(window, new object[] { id, true });
 }
Exemplo n.º 4
0
        /// <summary>
        /// 强制编辑器进行编译
        /// </summary>
        public static void CoerciveCompile()
        {
            Type type = EditorReflectionToolkit.GetTypeInEditorAssemblies("UnityEditor.Scripting.ScriptCompilation.EditorCompilationInterface");

            if (type != null)
            {
                MethodInfo method = type.GetMethod("RecompileAllScriptsOnNextTick", BindingFlags.Static | BindingFlags.Public);
                if (method != null)
                {
                    method.Invoke(null, null);
                }
            }
        }
Exemplo n.º 5
0
        private void OnEnable()
        {
            BuildPlayerWindow[] buildPlayerWindows = Resources.FindObjectsOfTypeAll <BuildPlayerWindow>();
            _buildPlayerWindow            = buildPlayerWindows.Length > 0 ? buildPlayerWindows[0] : CreateInstance <BuildPlayerWindow>();
            _onDisableMethod              = _buildPlayerWindow.GetType().GetMethod("OnDisable", BindingFlags.Instance | BindingFlags.NonPublic);
            _onGUIMethod                  = _buildPlayerWindow.GetType().GetMethod("OnGUI", BindingFlags.Instance | BindingFlags.NonPublic);
            _updateMethod                 = _buildPlayerWindow.GetType().GetMethod("Update", BindingFlags.Instance | BindingFlags.NonPublic);
            _calculateSelectedBuildTarget = EditorReflectionToolkit.GetTypeInEditorAssemblies("UnityEditor.EditorUserBuildSettingsUtils").GetMethod("CalculateSelectedBuildTarget", BindingFlags.Static | BindingFlags.Public);
            _activeBuildTargetGroup       = typeof(EditorUserBuildSettings).GetProperty("activeBuildTargetGroup", BindingFlags.Static | BindingFlags.NonPublic);

            CheckResourceMode();
            Check();
        }
Exemplo n.º 6
0
 private void CollapseAll()
 {
     Type type = EditorReflectionToolkit.GetTypeInEditorAssemblies("UnityEditor.SceneHierarchyWindow");
     EditorWindow window = EditorWindow.GetWindow(type);
     object hierarchy = window.GetType().GetProperty("sceneHierarchy", BindingFlags.Public | BindingFlags.Instance).GetValue(window);
     int[] expandedIDs = hierarchy.GetType().GetMethod("GetExpandedIDs", BindingFlags.Public | BindingFlags.Instance).Invoke(hierarchy, null) as int[];
     MethodInfo method = hierarchy.GetType().GetMethod("ExpandTreeViewItem", BindingFlags.NonPublic | BindingFlags.Instance);
     object[] args = new object[2];
     args[1] = false;
     for (int i = 0; i < expandedIDs.Length; i++)
     {
         args[0] = expandedIDs[i];
         method.Invoke(hierarchy, args);
     }
 }
        protected override void OnDefaultEnable()
        {
            base.OnDefaultEnable();

            _showProperty  = EditorPrefs.GetBool(EditorPrefsTable.RectTransform_Property, true);
            _showHierarchy = EditorPrefs.GetBool(EditorPrefsTable.RectTransform_Hierarchy, false);
            _showCopy      = EditorPrefs.GetBool(EditorPrefsTable.RectTransform_Copy, false);

            Type rectTransformEditor = EditorReflectionToolkit.GetTypeInEditorAssemblies("UnityEditor.RectTransformEditor");

            if (rectTransformEditor != null && targets != null && targets.Length > 0)
            {
                _originalEditor      = CreateEditor(targets, rectTransformEditor);
                _originalOnSceneGUI  = rectTransformEditor.GetMethod("OnSceneGUI", BindingFlags.Instance | BindingFlags.NonPublic);
                _originalOnHeaderGUI = rectTransformEditor.GetMethod("OnHeaderGUI", BindingFlags.Instance | BindingFlags.NonPublic);
            }
        }
Exemplo n.º 8
0
        protected override void OnEnable()
        {
            base.OnEnable();

            _settingItems.Clear();
            _settingItems.Add(new SettingItemMain());
            _settingItems.Add(new SettingItemAspectTrack());
            _settingItems.Add(new SettingItemAudio());
            _settingItems.Add(new SettingItemController());
            _settingItems.Add(new SettingItemWebRequest());

            _settingItemSigns.Clear();
            _settingItemSigns.Add(true);
            _settingItemSigns.Add(true);
            _settingItemSigns.Add(true);
            _settingItemSigns.Add(true);
            _settingItemSigns.Add(true);

            List <Type> types = EditorReflectionToolkit.GetTypesInEditorAssemblies(type =>
            {
                return(type.IsSubclassOf(typeof(SettingItemBase)) && type.GetCustomAttribute <InternalSettingItemAttribute>() == null);
            });

            for (int i = 0; i < types.Count; i++)
            {
                _settingItems.Add(Activator.CreateInstance(types[i]) as SettingItemBase);
                _settingItemSigns.Add(false);
            }

            for (int i = 0; i < _settingItems.Count; i++)
            {
                _settingItems[i].OnBeginSetting();
            }

            _resetGUIContent         = new GUIContent();
            _resetGUIContent.image   = EditorGUIUtility.IconContent("_Popup").image;
            _resetGUIContent.tooltip = "Menu";

            _editGUIContent         = new GUIContent();
            _editGUIContent.image   = EditorGUIUtility.IconContent("d_editicon.sml").image;
            _editGUIContent.tooltip = "Edit Module";

            _currentItem = -1;

            _itemFilter = "";
        }
Exemplo n.º 9
0
        protected override void OnDefaultEnable()
        {
            base.OnDefaultEnable();

            _pagePainter = new PagePainter(this);
            _pagePainter.AddPage("Property", EditorGUIUtility.IconContent("ToolHandleLocal").image, PropertyGUI);
            _pagePainter.AddPage("Hierarchy", EditorGUIUtility.IconContent("ToolHandlePivot").image, HierarchyGUI);
            _pagePainter.AddPage("Copy", EditorGUIUtility.IconContent("ToolHandleCenter").image, CopyGUI);

            Type rectTransformEditor = EditorReflectionToolkit.GetTypeInEditorAssemblies("UnityEditor.RectTransformEditor");

            if (rectTransformEditor != null && targets != null && targets.Length > 0)
            {
                _originalEditor      = CreateEditor(targets, rectTransformEditor);
                _originalOnSceneGUI  = rectTransformEditor.GetMethod("OnSceneGUI", BindingFlags.Instance | BindingFlags.NonPublic);
                _originalOnHeaderGUI = rectTransformEditor.GetMethod("OnHeaderGUI", BindingFlags.Instance | BindingFlags.NonPublic);
            }
        }
Exemplo n.º 10
0
 private void OnEnable()
 {
     if (_selectionAddMethod == null)
     {
         MethodInfo[] methods = EditorReflectionToolkit.GetTypeInEditorAssemblies("UnityEditor.Selection").GetMethods(BindingFlags.Static | BindingFlags.NonPublic);
         for (int i = 0; i < methods.Length; i++)
         {
             if (methods[i].Name == "Add")
             {
                 ParameterInfo[] parameters = methods[i].GetParameters();
                 if (parameters != null && parameters.Length == 1 && parameters[0].ParameterType.Name == "Object")
                 {
                     _selectionAddMethod = methods[i];
                     break;
                 }
             }
         }
     }
 }
Exemplo n.º 11
0
        /// <summary>
        /// LnkTools初始化
        /// </summary>
        private static void OnInitLnkTools()
        {
            IsEnableLnkTools    = EditorPrefs.GetBool(EditorPrefsTable.LnkTools_Enable, false);
            IsExpansionLnkTools = EditorPrefs.GetBool(EditorPrefsTable.LnkTools_Expansion, false);

            if (IsEnableLnkTools)
            {
                LnkToolss.Clear();
                List <Type> types = EditorReflectionToolkit.GetTypesInEditorAssemblies();
                for (int i = 0; i < types.Count; i++)
                {
                    MethodInfo[] methods = types[i].GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
                    for (int j = 0; j < methods.Length; j++)
                    {
                        if (methods[j].IsDefined(typeof(LnkToolsAttribute), false))
                        {
                            LnkToolsAttribute attribute = methods[j].GetCustomAttribute <LnkToolsAttribute>();
                            LnkTools          lnkTools  = new LnkTools(attribute.Tooltip, attribute.Priority, methods[j]);
                            LnkToolss.Add(lnkTools);
                        }
                    }
                }

                LnkToolss.Sort((x, y) =>
                {
                    if (x.Priority < y.Priority)
                    {
                        return(-1);
                    }
                    else if (x.Priority == y.Priority)
                    {
                        return(0);
                    }
                    else
                    {
                        return(1);
                    }
                });

                SceneView.onSceneGUIDelegate += OnLnkToolsGUI;
            }
        }
Exemplo n.º 12
0
        protected override void OnDefaultEnable()
        {
            base.OnDefaultEnable();

            _pagePainter = new PagePainter(this);
            _pagePainter.AddPage("Property", EditorGUIUtility.IconContent("ToolHandleLocal").image, PropertyGUI);
            _pagePainter.AddPage("Hierarchy", EditorGUIUtility.IconContent("ToolHandlePivot").image, HierarchyGUI);
            _pagePainter.AddPage("Copy", EditorGUIUtility.IconContent("ToolHandleCenter").image, CopyGUI);
            if (_rotationGUI == null)
            {
                Type type = EditorReflectionToolkit.GetTypeInEditorAssemblies("UnityEditor.TransformRotationGUI");
                _rotationGUI   = Activator.CreateInstance(type);
                _onEnable      = type.GetMethod("OnEnable", BindingFlags.Instance | BindingFlags.Public);
                _rotationField = type.GetMethod("RotationField", new Type[] { });
            }
            _onEnable.Invoke(_rotationGUI, new object[] { serializedObject.FindProperty("m_LocalRotation"), new GUIContent() });
            _onlyShowLocal = EditorPrefs.GetBool(EditorPrefsTable.Transform_OnlyShowLocal, false);

            SetLockState();
        }
Exemplo n.º 13
0
        protected override void OnInspectorDefaultGUI()
        {
            base.OnInspectorDefaultGUI();

            #region Property
            GUILayout.BeginHorizontal("MeTransitionHead");
            GUILayout.Space(12);
            bool showProperty = EditorGUILayout.Foldout(_showProperty, "Property", true);
            if (showProperty != _showProperty)
            {
                _showProperty = showProperty;
                EditorPrefs.SetBool(EditorPrefsTable.Transform_Property, _showProperty);
            }
            GUILayout.EndHorizontal();

            if (_showProperty)
            {
                GUILayout.BeginVertical(EditorGlobalTools.Styles.Box);

                GUILayout.BeginHorizontal();
                GUILayout.Label("Position", GUILayout.Width(80));
                Vector3 pos = EditorGUILayout.Vector3Field("", Target.position);
                if (pos != Target.position)
                {
                    Undo.RecordObject(Target, "Move " + Target.name);
                    Target.position = pos;
                    HasChanged();
                }
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                GUILayout.Label("Rotation", GUILayout.Width(80));
                Vector3 rot = EditorGUILayout.Vector3Field("", Target.rotation.eulerAngles);
                if (rot != Target.rotation.eulerAngles)
                {
                    Undo.RecordObject(Target, "Rotate " + Target.name);
                    Target.rotation = Quaternion.Euler(rot);
                    HasChanged();
                }
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                GUILayout.Label("Scale", GUILayout.Width(80));
                GUI.enabled = false;
                EditorGUILayout.Vector3Field("", Target.lossyScale);
                GUI.enabled = true;
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                GUILayout.Label("LocalPosition", GUILayout.Width(80));
                Vector3 localpos = EditorGUILayout.Vector3Field("", Target.localPosition);
                if (localpos != Target.localPosition)
                {
                    Undo.RecordObject(Target, "Move " + Target.name);
                    Target.localPosition = localpos;
                    HasChanged();
                }
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                GUILayout.Label("LocalRotation", GUILayout.Width(80));
                Vector3 localrot = EditorGUILayout.Vector3Field("", Target.localRotation.eulerAngles);
                if (localrot != Target.localRotation.eulerAngles)
                {
                    Undo.RecordObject(Target, "Rotate " + Target.name);
                    Target.localRotation = Quaternion.Euler(localrot);
                    HasChanged();
                }
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                GUILayout.Label("LocalScale", GUILayout.Width(80));
                Vector3 localsca = EditorGUILayout.Vector3Field("", Target.localScale);
                if (localsca != Target.localScale)
                {
                    Undo.RecordObject(Target, "Scale " + Target.name);
                    Target.localScale = localsca;
                    HasChanged();
                }
                GUILayout.EndHorizontal();

                GUILayout.EndVertical();
            }
            #endregion

            #region Hierarchy
            GUILayout.BeginHorizontal("MeTransitionHead");
            GUILayout.Space(12);
            bool showHierarchy = EditorGUILayout.Foldout(_showHierarchy, "Hierarchy", true);
            if (showHierarchy != _showHierarchy)
            {
                _showHierarchy = showHierarchy;
                EditorPrefs.SetBool(EditorPrefsTable.Transform_Hierarchy, _showHierarchy);
            }
            GUILayout.EndHorizontal();

            if (_showHierarchy)
            {
                GUILayout.BeginVertical(EditorGlobalTools.Styles.Box);

                GUILayout.BeginHorizontal();
                GUILayout.Label("Root: ", GUILayout.Width(80));
                EditorGUILayout.ObjectField(Target.root, typeof(Transform), true);
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                GUILayout.Label("Parent: ", GUILayout.Width(80));
                GUI.color = Target.parent ? Color.white : Color.gray;
                _parent   = EditorGUILayout.ObjectField(Target.parent, typeof(Transform), true) as Transform;
                if (_parent != Target.parent)
                {
                    Undo.RecordObject(Target, "Change Parent " + Target.name);
                    Target.SetParent(_parent);
                    HasChanged();
                }
                GUI.color = Color.white;
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                GUILayout.Label("Child Count: ", GUILayout.Width(80));
                GUILayout.Label(Target.childCount.ToString());
                GUILayout.FlexibleSpace();
                GUI.enabled = Target.childCount > 0;
                if (GUILayout.Button("Detach", "Minibutton"))
                {
                    if (EditorUtility.DisplayDialog("Prompt", "Are you sure you want to detach all children?", "Yes", "No"))
                    {
                        Undo.RecordObject(Target, "Detach Children");
                        Target.DetachChildren();
                        HasChanged();
                    }
                }
                GUI.enabled = true;
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                if (GUILayout.Button("Expand Children", "MinibuttonLeft"))
                {
                    Type         type   = EditorReflectionToolkit.GetTypeInEditorAssemblies("UnityEditor.SceneHierarchyWindow");
                    EditorWindow window = EditorWindow.GetWindow(type);
                    MethodInfo   method = window.GetType().GetMethod("SetExpandedRecursive", BindingFlags.Public | BindingFlags.Instance);
                    int          id     = Target.gameObject.GetInstanceID();
                    method.Invoke(window, new object[] { id, true });
                }
                if (GUILayout.Button("Retract Children", "MinibuttonRight"))
                {
                    Type         type   = EditorReflectionToolkit.GetTypeInEditorAssemblies("UnityEditor.SceneHierarchyWindow");
                    EditorWindow window = EditorWindow.GetWindow(type);
                    MethodInfo   method = window.GetType().GetMethod("SetExpandedRecursive", BindingFlags.Public | BindingFlags.Instance);
                    int          id     = Target.gameObject.GetInstanceID();
                    method.Invoke(window, new object[] { id, false });
                }
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                if (GUILayout.Button("Retract All", "Minibutton"))
                {
                    Type         type        = EditorReflectionToolkit.GetTypeInEditorAssemblies("UnityEditor.SceneHierarchyWindow");
                    EditorWindow window      = EditorWindow.GetWindow(type);
                    object       hierarchy   = window.GetType().GetProperty("sceneHierarchy", BindingFlags.Public | BindingFlags.Instance).GetValue(window);
                    int[]        expandedIDs = hierarchy.GetType().GetMethod("GetExpandedIDs", BindingFlags.Public | BindingFlags.Instance).Invoke(hierarchy, null) as int[];
                    MethodInfo   method      = hierarchy.GetType().GetMethod("ExpandTreeViewItem", BindingFlags.NonPublic | BindingFlags.Instance);
                    object[]     args        = new object[2];
                    args[1] = false;
                    for (int i = 0; i < expandedIDs.Length; i++)
                    {
                        args[0] = expandedIDs[i];
                        method.Invoke(hierarchy, args);
                    }
                }
                GUILayout.EndHorizontal();

                GUILayout.EndVertical();
            }
            #endregion

            #region Copy
            GUILayout.BeginHorizontal("MeTransitionHead");
            GUILayout.Space(12);
            bool showCopy = EditorGUILayout.Foldout(_showCopy, "Copy", true);
            if (showCopy != _showCopy)
            {
                _showCopy = showCopy;
                EditorPrefs.SetBool(EditorPrefsTable.Transform_Copy, _showCopy);
            }
            GUILayout.EndHorizontal();

            if (_showCopy)
            {
                GUILayout.BeginVertical(EditorGlobalTools.Styles.Box);

                GUILayout.BeginHorizontal();
                if (GUILayout.Button("Copy Position", EditorStyles.miniButtonLeft))
                {
                    GUIUtility.systemCopyBuffer = Target.position.ToCopyString("F4");
                    Log.Info("已复制:" + GUIUtility.systemCopyBuffer);
                }
                if (GUILayout.Button("Copy LocalPosition", EditorStyles.miniButtonRight))
                {
                    GUIUtility.systemCopyBuffer = Target.localPosition.ToCopyString("F4");
                    Log.Info("已复制:" + GUIUtility.systemCopyBuffer);
                }
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                if (GUILayout.Button("Copy Rotation", EditorStyles.miniButtonLeft))
                {
                    if (_copyQuaternion)
                    {
                        GUIUtility.systemCopyBuffer = Target.rotation.ToCopyString("F4");
                        Log.Info("已复制:" + GUIUtility.systemCopyBuffer);
                    }
                    else
                    {
                        string x = ClampAngle(Target.rotation.eulerAngles.x).ToString();
                        string y = ClampAngle(Target.rotation.eulerAngles.y).ToString();
                        string z = ClampAngle(Target.rotation.eulerAngles.z).ToString();

                        GUIUtility.systemCopyBuffer = x + "f," + y + "f," + z + "f";
                        Log.Info("已复制:" + GUIUtility.systemCopyBuffer);
                    }
                }
                if (GUILayout.Button("Copy LocalRotation", EditorStyles.miniButtonRight))
                {
                    if (_copyQuaternion)
                    {
                        GUIUtility.systemCopyBuffer = Target.localRotation.ToCopyString("F4");
                        Log.Info("已复制:" + GUIUtility.systemCopyBuffer);
                    }
                    else
                    {
                        string x = ClampAngle(Target.localRotation.eulerAngles.x).ToString();
                        string y = ClampAngle(Target.localRotation.eulerAngles.y).ToString();
                        string z = ClampAngle(Target.localRotation.eulerAngles.z).ToString();

                        GUIUtility.systemCopyBuffer = x + "f," + y + "f," + z + "f";
                        Log.Info("已复制:" + GUIUtility.systemCopyBuffer);
                    }
                }
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                if (GUILayout.Button("Copy Scale", EditorStyles.miniButton))
                {
                    GUIUtility.systemCopyBuffer = Target.localScale.ToCopyString("F4");
                    Log.Info("已复制:" + GUIUtility.systemCopyBuffer);
                }
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                if (GUILayout.Button("Copy Name", EditorStyles.miniButtonLeft))
                {
                    GUIUtility.systemCopyBuffer = Target.name;
                    Log.Info("已复制:" + GUIUtility.systemCopyBuffer);
                }
                if (GUILayout.Button("Copy FullName", EditorStyles.miniButtonRight))
                {
                    GUIUtility.systemCopyBuffer = Target.FullName();
                    Log.Info("已复制:" + GUIUtility.systemCopyBuffer);
                }
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                _copyQuaternion = GUILayout.Toggle(_copyQuaternion, "Copy Quaternion");
                GUILayout.EndHorizontal();

                GUILayout.EndVertical();
            }
            #endregion
        }
        private void DynamicGUI()
        {
            #region Namespace
            GUILayout.BeginHorizontal("AC BoldHeader");
            _isShowNamespace = EditorGUILayout.Foldout(_isShowNamespace, "Namespace", true);
            GUILayout.EndHorizontal();

            if (_isShowNamespace)
            {
                _scrollNamespace = GUILayout.BeginScrollView(_scrollNamespace, "TextField", GUILayout.Height(150));
                _namespace       = EditorGUILayout.TextArea(_namespace, EditorGlobalTools.Styles.Label);
                GUILayout.EndScrollView();
            }
            #endregion

            #region Assembly
            GUILayout.BeginHorizontal("AC BoldHeader");
            _isShowAssemblies = EditorGUILayout.Foldout(_isShowAssemblies, "Assembly", true);
            GUILayout.EndHorizontal();

            if (_isShowAssemblies)
            {
                GUILayout.BeginVertical(EditorGlobalTools.Styles.Box, GUILayout.Height(150));

                _scrollAssemblies = GUILayout.BeginScrollView(_scrollAssemblies);
                for (int i = 0; i < _assemblies.Count; i++)
                {
                    GUILayout.BeginHorizontal();
                    GUILayout.Label(i + ".", GUILayout.Width(25));
                    _assemblies[i] = EditorGUILayout.TextField(_assemblies[i]);
                    if (GUILayout.Button("Browse", EditorStyles.miniButtonLeft, GUILayout.Width(50)))
                    {
                        string initialPath = File.Exists(_assemblies[i]) ? Path.GetDirectoryName(_assemblies[i]) : _assembliesPath;
                        string path        = EditorUtility.OpenFilePanel("Browse Assembly Path", initialPath, "*.dll");
                        if (path.Length != 0)
                        {
                            _assemblies[i] = path;
                            GUI.FocusControl(null);
                        }
                    }
                    if (GUILayout.Button("Delete", EditorStyles.miniButtonRight, GUILayout.Width(50)))
                    {
                        _assemblies.RemoveAt(i);
                        GUI.FocusControl(null);
                    }
                    GUILayout.EndHorizontal();
                }
                GUILayout.BeginHorizontal();
                GUILayout.FlexibleSpace();
                if (GUILayout.Button("Add", EditorStyles.miniButton, GUILayout.Width(50)))
                {
                    _assemblies.Add("");
                }
                GUILayout.EndHorizontal();
                GUILayout.EndScrollView();

                GUILayout.EndVertical();
            }
            #endregion

            #region Code
            GUILayout.BeginHorizontal("AC BoldHeader");
            _isShowCode = EditorGUILayout.Foldout(_isShowCode, "Code", true);
            GUILayout.EndHorizontal();

            if (_isShowCode)
            {
                GUILayout.BeginHorizontal();
                if (GUILayout.Button("Clear Code", EditorStyles.miniButtonLeft))
                {
                    _code = "";
                    GUI.FocusControl(null);
                }
                if (GUILayout.Button("Clear Console", EditorStyles.miniButtonRight))
                {
                    Type       logEntries  = EditorReflectionToolkit.GetTypeInEditorAssemblies("UnityEditor.LogEntries");
                    MethodInfo clearMethod = logEntries.GetMethod("Clear", BindingFlags.Static | BindingFlags.Public);
                    clearMethod.Invoke(null, null);
                    GUI.FocusControl(null);
                }
                GUILayout.FlexibleSpace();
                GUILayout.EndHorizontal();

                _scrollCode = GUILayout.BeginScrollView(_scrollCode, "TextField");
                _code       = EditorGUILayout.TextArea(_code, EditorGlobalTools.Styles.Label);
                GUILayout.EndScrollView();
            }
            #endregion

            #region Execute
            GUILayout.BeginHorizontal();
            GUI.enabled         = _code != "";
            GUI.backgroundColor = Color.green;
            if (GUILayout.Button("Execute", EditorGlobalTools.Styles.LargeButton))
            {
                DynamicExecute();
            }
            GUI.backgroundColor = Color.white;
            GUI.enabled         = true;
            GUILayout.EndHorizontal();
            #endregion
        }