├── README.md.meta ├── package.json.meta ├── Editor.meta ├── Runtime.meta ├── Editor ├── com.ricardogodoy.hierarchyseparator.Editor.asmdef.meta ├── HierarchySeparatorEditor.cs.meta ├── com.ricardogodoy.hierarchyseparator.Editor.asmdef └── HierarchySeparatorEditor.cs ├── Runtime ├── com.ricardogodoy.hierarchyseparator.Runtime.asmdef.meta ├── HierarchySeparator.cs.meta ├── com.ricardogodoy.hierarchyseparator.Runtime.asmdef └── HierarchySeparator.cs ├── package.json └── README.md /README.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2fe709b1ee2683144938c91455987a44 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /package.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8a1d5a4085350b64bb82a5a00bc2f980 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 99f5e475f90cc7b43a6df5b48ec32257 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e8f2cf2adfe77f94d80a9ab2471e6297 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Editor/com.ricardogodoy.hierarchyseparator.Editor.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 70782b6e2b3d7ec419063bcb3966a40a 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Runtime/com.ricardogodoy.hierarchyseparator.Runtime.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5acc20895105d274c994ba2953b5dbe3 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Runtime/HierarchySeparator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 82b4db11c34c2d246aaa4ed7170ea2f4 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/HierarchySeparatorEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1b48268d06bf7924fba4fc34a8d0f4b2 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "com.ricardogodoy.hierarchyseparator", 3 | "version": "1.0.3", 4 | "description": "An handsome separator for your project hierarchy", 5 | "displayName": "Hierarchy Separator", 6 | "unity": "2020.3", 7 | "author": "Ricardo Godoy", 8 | "hideInEditor": true, 9 | "keywords": ["hierarchy", "editor"] 10 | } 11 | -------------------------------------------------------------------------------- /Editor/com.ricardogodoy.hierarchyseparator.Editor.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "com.ricardogodoy.hierarchyseparator.Editor", 3 | "rootNamespace": "", 4 | "references": [ 5 | "GUID:5acc20895105d274c994ba2953b5dbe3" 6 | ], 7 | "includePlatforms": [ 8 | "Editor" 9 | ], 10 | "excludePlatforms": [], 11 | "allowUnsafeCode": false, 12 | "overrideReferences": false, 13 | "precompiledReferences": [], 14 | "autoReferenced": true, 15 | "defineConstraints": [], 16 | "versionDefines": [], 17 | "noEngineReferences": false 18 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Hierarchy Separator 2 | 3 | A separator for your project hierarchy 4 | 5 | ## How to use 6 | ![How to Use](http://g.recordit.co/PXMcX3ToH3.gif) 7 | 8 | 1. Open package manager 9 | 2. Click on plus button and "Add package from git URL" 10 | 3. Paste https://github.com/RicardoQLG/HierarchySeparator.git and click Add 11 | 4. Wait for Package manager install package 12 | 5. Left click on Hierarchy panel and chose Separator 13 | 6. Now you can rename separator like any other GameObject and change color on inspector 14 | 15 | ## References 16 | 17 | [GrabielBigardi](https://github.com/GabrielBigardi/Unity-Utils) who make an awesome collection of Unity tools -------------------------------------------------------------------------------- /Runtime/com.ricardogodoy.hierarchyseparator.Runtime.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "com.ricardogodoy.hierarchyseparator.Runtime", 3 | "rootNamespace": "", 4 | "references": [], 5 | "includePlatforms": [], 6 | "excludePlatforms": [ 7 | "Android", 8 | "CloudRendering", 9 | "GameCoreScarlett", 10 | "GameCoreXboxOne", 11 | "iOS", 12 | "LinuxStandalone64", 13 | "Lumin", 14 | "macOSStandalone", 15 | "PS4", 16 | "PS5", 17 | "Stadia", 18 | "Switch", 19 | "tvOS", 20 | "WSA", 21 | "WebGL", 22 | "WindowsStandalone32", 23 | "WindowsStandalone64", 24 | "XboxOne" 25 | ], 26 | "allowUnsafeCode": false, 27 | "overrideReferences": false, 28 | "precompiledReferences": [], 29 | "autoReferenced": true, 30 | "defineConstraints": [], 31 | "versionDefines": [], 32 | "noEngineReferences": false 33 | } -------------------------------------------------------------------------------- /Editor/HierarchySeparatorEditor.cs: -------------------------------------------------------------------------------- 1 | using UnityEditor; 2 | using UnityEngine; 3 | 4 | [CustomEditor(typeof(HierarchySeparator))] 5 | [CanEditMultipleObjects] 6 | public class HierarchySeparatorEditor : Editor 7 | { 8 | private SerializedProperty _outlineSize; 9 | private SerializedProperty _outlineColor; 10 | private SerializedProperty _barColor; 11 | private SerializedProperty _textColor; 12 | 13 | public void OnEnable() 14 | { 15 | _outlineSize = serializedObject.FindProperty("m_OutlineSize"); 16 | _outlineColor = serializedObject.FindProperty("m_OutlineColor"); 17 | _barColor = serializedObject.FindProperty("m_BarColor"); 18 | _textColor = serializedObject.FindProperty("m_TextColor"); 19 | } 20 | 21 | public override void OnInspectorGUI() 22 | { 23 | serializedObject.Update(); 24 | 25 | EditorGUILayout.PropertyField(_outlineSize); 26 | EditorGUILayout.PropertyField(_outlineColor); 27 | EditorGUILayout.PropertyField(_barColor); 28 | EditorGUILayout.PropertyField(_textColor); 29 | 30 | serializedObject.ApplyModifiedProperties(); 31 | } 32 | } -------------------------------------------------------------------------------- /Runtime/HierarchySeparator.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | 4 | [InitializeOnLoad] 5 | public class HierarchySeparator : MonoBehaviour 6 | { 7 | [HideInInspector] 8 | [SerializeField] 9 | private Color m_OutlineColor = Color.black; 10 | public Color OutlineColor 11 | { 12 | get => m_OutlineColor; 13 | set 14 | { 15 | value.a = 1f; 16 | m_OutlineColor = value; 17 | } 18 | } 19 | 20 | [HideInInspector] 21 | [SerializeField] 22 | private Color m_BarColor = Color.black; 23 | public Color BarColor 24 | { 25 | get => m_BarColor; 26 | set 27 | { 28 | value.a = 1f; 29 | m_BarColor = value; 30 | } 31 | } 32 | 33 | [HideInInspector] 34 | [SerializeField] 35 | private Color m_TextColor = Color.white; 36 | public Color TextColor 37 | { 38 | get => m_TextColor; 39 | set 40 | { 41 | value.a = 1f; 42 | m_TextColor = value; 43 | } 44 | } 45 | 46 | [HideInInspector] 47 | [SerializeField] 48 | private int m_OutlineSize = 0; 49 | public int OutlineSize 50 | { 51 | get => m_OutlineSize; 52 | set 53 | { 54 | m_OutlineSize = value; 55 | } 56 | } 57 | 58 | static HierarchySeparator() 59 | { 60 | EditorApplication.hierarchyWindowItemOnGUI += HierarchyWindowItemOnGUI; 61 | } 62 | 63 | [MenuItem("GameObject/Separator", false, 30)] 64 | public static void CreateSeparator(MenuCommand menuCommand) 65 | { 66 | GameObject separator = new GameObject("Separator"); 67 | separator.AddComponent(); 68 | GameObjectUtility.SetParentAndAlign(separator, menuCommand.context as GameObject); 69 | Undo.RegisterCreatedObjectUndo(separator, "Create " + separator.name); 70 | Selection.activeObject = separator; 71 | } 72 | 73 | static void HierarchyWindowItemOnGUI(int instanceID, Rect selectionRect) 74 | { 75 | GameObject gameObject = EditorUtility.InstanceIDToObject(instanceID) as GameObject; 76 | 77 | if (gameObject == null) return; 78 | if (!gameObject.TryGetComponent(out HierarchySeparator hierarchy)) return; 79 | 80 | GUIStyle guiStyle = new GUIStyle(); 81 | guiStyle.fontStyle = FontStyle.Bold; 82 | guiStyle.normal.textColor = hierarchy.TextColor; 83 | guiStyle.alignment = TextAnchor.MiddleCenter; 84 | 85 | EditorGUI.DrawRect(selectionRect, hierarchy.OutlineColor); 86 | EditorGUI.DrawRect(new Rect(selectionRect.x + hierarchy.OutlineSize, selectionRect.y + hierarchy.OutlineSize, selectionRect.width - (hierarchy.OutlineSize * 2), selectionRect.height - (hierarchy.OutlineSize * 2)), hierarchy.BarColor); 87 | EditorGUI.DropShadowLabel(selectionRect, $"{gameObject.name.ToUpperInvariant()}", guiStyle); 88 | } 89 | 90 | public void Start () 91 | { 92 | gameObject.SetActive(false); 93 | } 94 | 95 | public void Reset() 96 | { 97 | gameObject.tag = "EditorOnly"; 98 | } 99 | 100 | void OnValidate() 101 | { 102 | EditorApplication.RepaintHierarchyWindow(); 103 | } 104 | } --------------------------------------------------------------------------------