ソースコード
using System.Reflection;
using UnityEditor;
namespace Kogane
{
[InitializeOnLoad]
internal static class RemoveMenuItem
{
static RemoveMenuItem()
{
EditorApplication.delayCall += Remove;
void Remove()
{
var methodInfo = typeof( Menu ).GetMethod( "RemoveMenuItem", BindingFlags.NonPublic | BindingFlags.Static );
RemoveMenuItem( "Assets/Create/Folder" );
RemoveMenuItem( "Assets/Create/2D" );
RemoveMenuItem( "Assets/Create/Shader" );
RemoveMenuItem( "Assets/Create/Testing" );
RemoveMenuItem( "Assets/Create/Playables" );
RemoveMenuItem( "Assets/Create/Assembly Definition" );
RemoveMenuItem( "Assets/Create/Assembly Definition Reference" );
RemoveMenuItem( "Assets/Create/Text" );
RemoveMenuItem( "Assets/Create/TextMeshPro" );
RemoveMenuItem( "Assets/Create/Scene" );
RemoveMenuItem( "Assets/Create/Scene Template" );
RemoveMenuItem( "Assets/Create/Scene Template From Scene" );
RemoveMenuItem( "Assets/Create/Prefab" );
RemoveMenuItem( "Assets/Create/Prefab Variant" );
RemoveMenuItem( "Assets/Create/Material" );
RemoveMenuItem( "Assets/Create/Material Variant" );
RemoveMenuItem( "Assets/Create/Render Texture" );
RemoveMenuItem( "Assets/Create/Animator Controller" );
RemoveMenuItem( "Assets/Create/Animation" );
RemoveMenuItem( "Assets/Create/Physic Material" );
RemoveMenuItem( "Assets/Create/GUI Skin" );
RemoveMenuItem( "Assets/Create/UI Toolkit" );
RemoveMenuItem( "Assets/Create/Search" );
RemoveMenuItem( "Assets/Create/Brush" );
RemoveMenuItem( "Assets/Create/Terrain Layer" );
void RemoveMenuItem( string name )
{
methodInfo.Invoke( null, new object[] { name } );
}
}
}
}
}
使用例
Before |
After |
|
|
検証環境
- Windows 10
- Unity 2022.1.23f1