├── Editor.meta ├── Editor ├── HierarchyMenuCustomizer.cs ├── HierarchyMenuCustomizer.cs.meta ├── HierarchyMenuSettings.cs ├── HierarchyMenuSettings.cs.meta ├── HierarchyMenuSettingsDataDrawer.cs ├── HierarchyMenuSettingsDataDrawer.cs.meta ├── HierarchyMenuSettingsEditor.cs ├── HierarchyMenuSettingsEditor.cs.meta ├── UniHierarchyMenuCustomizer.asmdef └── UniHierarchyMenuCustomizer.asmdef.meta ├── LICENSE.md ├── LICENSE.md.meta ├── README.md ├── README.md.meta ├── README_JP.md ├── README_JP.md.meta ├── package.json └── package.json.meta /Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 296b1f341c469af4a83dc82351c68029 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Editor/HierarchyMenuCustomizer.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using UnityEditor; 3 | using UnityEngine; 4 | 5 | namespace UniHierarchyMenuCustomizer.Internal 6 | { 7 | [InitializeOnLoad] 8 | internal static class HierarchyMenuCustomizer 9 | { 10 | private static HierarchyMenuSettings m_settings; 11 | 12 | static HierarchyMenuCustomizer() 13 | { 14 | EditorApplication.hierarchyWindowItemOnGUI += OnGUI; 15 | } 16 | 17 | private static HierarchyMenuSettings GetSettings() 18 | { 19 | if ( m_settings == null ) 20 | { 21 | m_settings = AssetDatabase 22 | .FindAssets( "t:HierarchyMenuSettings" ) 23 | .Select( AssetDatabase.GUIDToAssetPath ) 24 | .Select( AssetDatabase.LoadAssetAtPath ) 25 | .FirstOrDefault() 26 | ; 27 | } 28 | 29 | return m_settings; 30 | } 31 | 32 | private static void OnGUI( int instanceID, Rect selectionRect ) 33 | { 34 | if ( Event.current.type != EventType.ContextClick ) return; 35 | 36 | var settings = GetSettings(); 37 | 38 | if ( settings == null ) return; 39 | 40 | Event.current.Use(); 41 | 42 | var list = settings.List; 43 | var genericMenu = new GenericMenu(); 44 | 45 | for ( var i = 0; i < list.Count; i++ ) 46 | { 47 | var data = list[ i ]; 48 | 49 | if ( data.IsSeparator ) 50 | { 51 | genericMenu.AddSeparator( data.Name ); 52 | } 53 | else 54 | { 55 | var name = data.Name; 56 | var menuItemPath = data.MenuItemPath; 57 | var content = new GUIContent( name ); 58 | 59 | genericMenu.AddItem 60 | ( 61 | content: content, 62 | @on: false, 63 | func: () => EditorApplication.ExecuteMenuItem( menuItemPath ) 64 | ); 65 | } 66 | } 67 | 68 | genericMenu.ShowAsContext(); 69 | } 70 | } 71 | } -------------------------------------------------------------------------------- /Editor/HierarchyMenuCustomizer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c8d72b79cb390d7499640db5e47792ef 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/HierarchyMenuSettings.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | namespace UniHierarchyMenuCustomizer.Internal 6 | { 7 | [CreateAssetMenu( fileName = "HierarchyMenuSettings", menuName = "UniHierarchyMenuCustomizer/HierarchyMenuSettings", order = 9000 )] 8 | internal sealed class HierarchyMenuSettings : ScriptableObject 9 | { 10 | [SerializeField] private Data[] m_list = null; 11 | 12 | public IList List => m_list; 13 | 14 | public void Reset() 15 | { 16 | m_list = new Data[0]; 17 | } 18 | 19 | public void ResetToDefault() 20 | { 21 | m_list = new[] 22 | { 23 | new Data( "Copy", "Edit/Copy" ), 24 | new Data( "Paste", "Edit/Paste" ), 25 | 26 | new Data(), 27 | 28 | new Data( "Rename", "Edit/Rename" ), 29 | new Data( "Duplicate", "Edit/Duplicate" ), 30 | new Data( "Delete", "Edit/Delete" ), 31 | 32 | new Data(), 33 | 34 | new Data( "Select Children", "Edit/Select Children" ), 35 | new Data( "Select Prefab Root", "Edit/Select Prefab Root" ), 36 | 37 | new Data(), 38 | 39 | new Data( "Create Empty", "GameObject/Create Empty" ), 40 | 41 | new Data( "3D Object/Cube", "GameObject/3D Object/Cube" ), 42 | new Data( "3D Object/Sphere", "GameObject/3D Object/Sphere" ), 43 | new Data( "3D Object/Capsule", "GameObject/3D Object/Capsule" ), 44 | new Data( "3D Object/Cylinder", "GameObject/3D Object/Cylinder" ), 45 | new Data( "3D Object/Plane", "GameObject/3D Object/Plane" ), 46 | new Data( "3D Object/Quad", "GameObject/3D Object/Quad" ), 47 | new Data( "3D Object/Text - TextMeshPro", "GameObject/3D Object/Text - TextMeshPro" ), 48 | new Data( "3D Object/Ragdoll...", "GameObject/3D Object/Ragdoll..." ), 49 | new Data( "3D Object/Terrain", "GameObject/3D Object/Terrain" ), 50 | new Data( "3D Object/Tree", "GameObject/3D Object/Tree" ), 51 | new Data( "3D Object/Wind Zone", "GameObject/3D Object/Wind Zone" ), 52 | new Data( "3D Object/3D Text", "GameObject/3D Object/3D Text" ), 53 | 54 | new Data( "2D Object/Sprite", "GameObject/2D Object/Sprite" ), 55 | new Data( "2D Object/Sprite Mask", "GameObject/2D Object/Sprite Mask" ), 56 | new Data( "2D Object/Tilemap", "GameObject/2D Object/Tilemap" ), 57 | new Data( "2D Object/Hexagonal Point Top Tilemap", "GameObject/2D Object/Hexagonal Point Top Tilemap" ), 58 | new Data( "2D Object/Hexagonal Flat Top Tilemap", "GameObject/2D Object/Hexagonal Flat Top Tilemap" ), 59 | new Data( "2D Object/Isometric Tilemap", "GameObject/2D Object/Isometric Tilemap" ), 60 | new Data( "2D Object/Isometric Z As Y Tilemap", "GameObject/2D Object/Isometric Z As Y Tilemap" ), 61 | 62 | new Data( "Effects/Particle System", "GameObject/Effects/Particle System" ), 63 | new Data( "Effects/Particle System Force Field", "GameObject/Effects/Particle System Force Field" ), 64 | new Data( "Effects/Trail", "GameObject/Effects/Trail" ), 65 | new Data( "Effects/Line", "GameObject/Effects/Line" ), 66 | 67 | new Data( "Light/Directional Light", "GameObject/Light/Directional Light" ), 68 | new Data( "Light/Point Light", "GameObject/Light/Point Light" ), 69 | new Data( "Light/Spotlight", "GameObject/Light/Spotlight" ), 70 | new Data( "Light/Area Light", "GameObject/Light/Area Light" ), 71 | new Data( "Light/Reflection Probe", "GameObject/Light/Reflection Probe" ), 72 | new Data( "Light/Light Probe Group", "GameObject/Light/Light Probe Group" ), 73 | 74 | new Data( "Audio/Audio Source", "GameObject/Audio/Audio Source" ), 75 | new Data( "Audio/Audio Reverb Zone", "GameObject/Audio/Audio Reverb Zone" ), 76 | 77 | new Data( "Video/Video Player", "GameObject/Video/Video Player" ), 78 | 79 | new Data( "UI/Text", "GameObject/UI/Text" ), 80 | new Data( "UI/Text - TextMeshPro", "GameObject/UI/Text - TextMeshPro" ), 81 | new Data( "UI/Image", "GameObject/UI/Image" ), 82 | new Data( "UI/Raw Image", "GameObject/UI/Raw Image" ), 83 | new Data( "UI/Button", "GameObject/UI/Button" ), 84 | new Data( "UI/Button - TextMeshPro", "GameObject/UI/Button - TextMeshPro" ), 85 | new Data( "UI/Toggle", "GameObject/UI/Toggle" ), 86 | new Data( "UI/Slider", "GameObject/UI/Slider" ), 87 | new Data( "UI/Scrollbar", "GameObject/UI/Scrollbar" ), 88 | new Data( "UI/Dropdown", "GameObject/UI/Dropdown" ), 89 | new Data( "UI/Dropdown - TextMeshPro", "GameObject/UI/Dropdown - TextMeshPro" ), 90 | new Data( "UI/Input Field", "GameObject/UI/Input Field" ), 91 | new Data( "UI/Input Field - TextMeshPro", "GameObject/UI/Input Field - TextMeshPro" ), 92 | new Data( "UI/Canvas", "GameObject/UI/Canvas" ), 93 | new Data( "UI/Panel", "GameObject/UI/Panel" ), 94 | new Data( "UI/Scroll View", "GameObject/UI/Scroll View" ), 95 | new Data( "UI/Event System", "GameObject/UI/Event System" ), 96 | 97 | new Data( "Camera", "GameObject/Camera" ), 98 | }; 99 | } 100 | 101 | [Serializable] 102 | internal sealed class Data 103 | { 104 | [SerializeField] private string m_name = string.Empty; 105 | [SerializeField] private string m_menuItemPath = string.Empty; 106 | 107 | public string Name => m_name; 108 | public string MenuItemPath => m_menuItemPath; 109 | public bool IsSeparator => string.IsNullOrWhiteSpace( m_menuItemPath ); 110 | 111 | public Data() 112 | { 113 | } 114 | 115 | public Data( string name ) 116 | { 117 | m_name = name; 118 | } 119 | 120 | public Data( string name, string menuItemPath ) 121 | { 122 | m_name = name; 123 | m_menuItemPath = menuItemPath; 124 | } 125 | } 126 | } 127 | } -------------------------------------------------------------------------------- /Editor/HierarchyMenuSettings.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8f1e456dc6b465044ad3e25a064729a9 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/HierarchyMenuSettingsDataDrawer.cs: -------------------------------------------------------------------------------- 1 | using UnityEditor; 2 | using UnityEngine; 3 | 4 | namespace UniHierarchyMenuCustomizer.Internal 5 | { 6 | [CustomPropertyDrawer( typeof( HierarchyMenuSettings.Data ) )] 7 | internal sealed class HierarchyMenuSettingsDataDrawer : PropertyDrawer 8 | { 9 | public override void OnGUI 10 | ( 11 | Rect position, 12 | SerializedProperty property, 13 | GUIContent label 14 | ) 15 | { 16 | using ( new EditorGUI.PropertyScope( position, label, property ) ) 17 | { 18 | position.height = EditorGUIUtility.singleLineHeight; 19 | 20 | var nameRect = new Rect( position ) 21 | { 22 | width = position.width, 23 | }; 24 | 25 | var menuItemPathRect = new Rect( position ) 26 | { 27 | y = nameRect.yMax + 2, 28 | }; 29 | 30 | var nameProperty = property.FindPropertyRelative( "m_name" ); 31 | var menuItemProperty = property.FindPropertyRelative( "m_menuItemPath" ); 32 | 33 | EditorGUI.PropertyField( nameRect, nameProperty ); 34 | EditorGUI.PropertyField( menuItemPathRect, menuItemProperty ); 35 | } 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /Editor/HierarchyMenuSettingsDataDrawer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 947c166b1063c1340aa9e0c0199ee099 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/HierarchyMenuSettingsEditor.cs: -------------------------------------------------------------------------------- 1 | using UnityEditor; 2 | using UnityEditorInternal; 3 | using UnityEngine; 4 | 5 | namespace UniHierarchyMenuCustomizer.Internal 6 | { 7 | [CustomEditor( typeof( HierarchyMenuSettings ) )] 8 | internal sealed class HierarchyMenuSettingsEditor : Editor 9 | { 10 | private SerializedProperty m_property; 11 | private ReorderableList m_reorderableList; 12 | 13 | private void OnEnable() 14 | { 15 | m_property = serializedObject.FindProperty( "m_list" ); 16 | m_reorderableList = new ReorderableList( serializedObject, m_property ) 17 | { 18 | elementHeight = 44, 19 | drawElementCallback = OnDrawElement 20 | }; 21 | } 22 | 23 | private void OnDrawElement 24 | ( 25 | Rect rect, 26 | int index, 27 | bool isActive, 28 | bool isFocused 29 | ) 30 | { 31 | var element = m_property.GetArrayElementAtIndex( index ); 32 | rect.height -= 4; 33 | rect.y += 2; 34 | EditorGUI.PropertyField( rect, element ); 35 | } 36 | 37 | public override void OnInspectorGUI() 38 | { 39 | serializedObject.Update(); 40 | 41 | m_reorderableList.DoLayoutList(); 42 | 43 | if ( GUILayout.Button( "Reset" ) ) 44 | { 45 | Undo.RecordObject( target, "Reset" ); 46 | var settings = target as HierarchyMenuSettings; 47 | settings.Reset(); 48 | } 49 | 50 | if ( GUILayout.Button( "Reset To Default" ) ) 51 | { 52 | Undo.RecordObject( target, "Reset To Default" ); 53 | var settings = target as HierarchyMenuSettings; 54 | settings.ResetToDefault(); 55 | } 56 | 57 | serializedObject.ApplyModifiedProperties(); 58 | } 59 | } 60 | } -------------------------------------------------------------------------------- /Editor/HierarchyMenuSettingsEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1c014fd3d934f07448f6d10df8340a64 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/UniHierarchyMenuCustomizer.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "UnityHierarchyMenuCustomizer", 3 | "references": [], 4 | "includePlatforms": [ 5 | "Editor" 6 | ], 7 | "excludePlatforms": [], 8 | "allowUnsafeCode": false, 9 | "overrideReferences": false, 10 | "precompiledReferences": [], 11 | "autoReferenced": false, 12 | "defineConstraints": [], 13 | "versionDefines": [], 14 | "noEngineReferences": false 15 | } -------------------------------------------------------------------------------- /Editor/UniHierarchyMenuCustomizer.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 891bfdcc5e81b41469b3489844bd4654 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /LICENSE.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0341a63e76de5984e8c57173c5f08820 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [日本語の Readme はこちら](https://github.com/baba-s/UniHierarchyMenuCustomizer/blob/master/README_JP.md) 2 | 3 | # Uni Hierarchy Menu Customizer 4 | 5 | ![](https://cdn-ak.f.st-hatena.com/images/fotolife/b/baba_s/20200203/20200203194906.png) 6 | 7 | Editor extension that allows you to customize the menu that appears when you right-click on Hierarchy. 8 | 9 | ## Install 10 | 11 | ```json 12 | "com.baba-s.uni-hierarchy-menu-customizer": "https://github.com/baba-s/UniHierarchyMenuCustomizer.git", 13 | ``` 14 | 15 | Add the above dependencies to manifest.json. 16 | 17 | ## Usages 18 | 19 | ![](https://cdn-ak.f.st-hatena.com/images/fotolife/b/baba_s/20200203/20200203194910.png) 20 | 21 | Select "+> Hierarchy Menu Settings" in the Project view. 22 | 23 | ![](https://cdn-ak.f.st-hatena.com/images/fotolife/b/baba_s/20200203/20200203194913.png) 24 | 25 | You can customize the items displayed in the menu with the created "HierarchyMenuSettings" asset. 26 | 27 | ![](https://cdn-ak.f.st-hatena.com/images/fotolife/b/baba_s/20200203/20200203194915.png) 28 | 29 | Press the "Reset To Default" button to apply the default settings. -------------------------------------------------------------------------------- /README.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9964c40aa1ed15043b1aa0e2e196068b 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /README_JP.md: -------------------------------------------------------------------------------- 1 | # Uni Hierarchy Menu Customizer 2 | 3 | ![](https://cdn-ak.f.st-hatena.com/images/fotolife/b/baba_s/20200203/20200203194906.png) 4 | 5 | Hierarchy を右クリックした時に表示されるメニューをカスタマイズできるエディタ拡張 6 | 7 | ## インストール 8 | 9 | ```json 10 | "com.baba-s.uni-hierarchy-menu-customizer": "https://github.com/baba-s/UniHierarchyMenuCustomizer.git", 11 | ``` 12 | 13 | manifest.json に上記の記述を追加します 14 | 15 | ## 使い方 16 | 17 | ![](https://cdn-ak.f.st-hatena.com/images/fotolife/b/baba_s/20200203/20200203194910.png) 18 | 19 | Project ビューの「+ > Hierarchy Menu Settings」を選択して 20 | 21 | ![](https://cdn-ak.f.st-hatena.com/images/fotolife/b/baba_s/20200203/20200203194913.png) 22 | 23 | 作成した「HierarchyMenuSettings」アセットでメニューに表示される項目をカスタマイズできます 24 | 25 | ![](https://cdn-ak.f.st-hatena.com/images/fotolife/b/baba_s/20200203/20200203194915.png) 26 | 27 | 「Reset To Default」ボタンを押すとデフォルトの設定が適用されるので 28 | ここからカスタマイズすることがオススメです -------------------------------------------------------------------------------- /README_JP.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6d95778ffc90a5b4287158183e59dd5f 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "com.baba-s.uni-hierarchy-menu-customizer", 3 | "displayName": "UniHierarchyMenuCustomizer", 4 | "version": "1.0.0", 5 | "unity": "2019.3", 6 | "author": "baba-s" 7 | } -------------------------------------------------------------------------------- /package.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9e7bc568e976db44ab7173fc01bca701 3 | PackageManifestImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | --------------------------------------------------------------------------------