コガネブログ

平日更新を目標にUnityやC#、Visual Studioなどのゲーム開発アレコレを書いていきます

【Unity】Unity で用意されているすべてのエディタウィンドウのクラス情報を取得してみる

ソースコード

using System;
using System.Linq;
using UnityEditor;

public static class Utils
{
    public static Type[] GetAllEditorWindowTypes()
    {
        var editorWindow = typeof( EditorWindow );
        
        var result = AppDomain.CurrentDomain
            .GetAssemblies()
            .SelectMany( c => c.GetTypes() )
            .Where( c => c.IsSubclassOf( editorWindow ) )
            .ToArray()
        ;

        return result;
    }
}

使い方

using System.Linq;
using UnityEditor;
using UnityEngine;

public static class Example
{
    [MenuItem( "Tools/Hoge" )]
    private static void Hoge()
    {
        var names = GetAllEditorWindowTypes()
            .Select( c => c.FullName )
            .ToArray()
        ;

        var text = string.Join( "\n", names );

        Debug.Log( text );
    }
}

一覧

SyntaxTree.VisualStudio.Unity.Bridge.AboutWindow
SyntaxTree.VisualStudio.Unity.Bridge.Configuration.ConfigurationWindow
UnityEditor.Graphs.AnimatorControllerTool
UnityEditor.Graphs.LayerSettingsWindow
UnityEditor.Graphs.ParameterControllerEditor
UnityEditor.Graphs.AnimationStateMachine.AddStateMachineBehaviourComponentWindow
UnityEditor.Timeline.TimelineWindow
UnityEditor.TestTools.TestRunner.TestRunnerWindow
Unity.PackageManager.UI.Window
UnityEditor.LicenseManagementWindow
UnityEditor.ScriptableWizard
UnityEditor.NScreen.RemoteGame
UnityEditor.SketchUpImportDlg
UnityEditor.AssembleEditorSkin
UnityEditor.BuildPlayerWindow
UnityEditor.ConsoleWindow
UnityEditor.IconSelector
UnityEditor.ObjectSelector
UnityEditor.ProjectBrowser
UnityEditor.RagdollBuilder
UnityEditor.SceneHierarchySortingWindow
UnityEditor.SceneHierarchyWindow
UnityEditorInternal.AddCurvesPopup
UnityEditor.AnimationWindow
UnityEditor.CurveEditorWindow
UnityEditor.AnnotationWindow
UnityEditor.LayerVisibilityWindow
UnityEditor.AssetStoreInstaBuyWindow
UnityEditor.AssetStoreLoginWindow
UnityEditor.AssetStoreWindow
UnityEditor.AudioMixerWindow
UnityEditor.Collaboration.CollabPublishDialog
UnityEditor.Collaboration.CollabCannotPublishDialog
UnityEditor.CollabHistoryWindow
UnityEditor.CollabToolbarWindow
UnityEditor.GameView
UnityEditor.AboutWindow
UnityEditor.AssetSaveDialog
UnityEditor.BumpMapSettingsFixingWindow
UnityEditor.ColorPicker
UnityEditor.EditorUpdateWindow
UnityEditor.FallbackEditorWindow
UnityEditor.GradientPicker
UnityEditor.PackageExport
UnityEditor.PackageImport
UnityEditor.PopupWindow
UnityEditor.PopupWindowWithoutFocus
UnityEditor.PragmaFixingWindow
UnityEditor.SaveWindowLayout
UnityEditor.DeleteWindowLayout
UnityEditor.SnapSettings
UnityEditor.TreeViewExamples.TreeViewTestWindow
UnityEditor.GUIViewDebuggerWindow
UnityEditor.InstructionOverlayWindow
UnityEditor.AddComponentWindow
UnityEditor.InspectorWindow
UnityEditor.PreviewWindow
UnityEditor.AddShaderVariantWindow
UnityEditor.LookDevView
UnityEditor.ParticleSystemWindow
UnityEditorInternal.VR.HolographicEmulationWindow
UnityEditor.FrameDebuggerWindow
UnityEditor.PreferencesWindow
UnityEditor.SearchableEditorWindow
UnityEditor.LightingExplorerWindow
UnityEditor.LightingWindow
UnityEditor.NavMeshEditorWindow
UnityEditor.OcclusionCullingWindow
UnityEditor.PhysicsDebugWindow
UnityEditor.TierSettingsWindow
UnityEditor.SceneView
UnityEditorInternal.SpriteEditorMenu
UnityEditor.SpriteEditorWindow
UnityEditor.Sprites.PackerWindow
UnityEditor.SpriteUtilityWindow
UnityEditor.TerrainSplatEditor
UnityEditor.TerrainWizard
UnityEditor.ImportRawHeightmap
UnityEditor.ExportRawHeightmap
UnityEditor.TreeWizard
UnityEditor.DetailMeshWizard
UnityEditor.DetailTextureWizard
UnityEditor.PlaceTreeWizard
UnityEditor.FlattenHeightmap
UnityEditor.UndoWindow
UnityEditor.Connect.UnityConnectEditorWindow
UnityEditor.MetroCertificatePasswordWindow
UnityEditor.MetroCreateTestCertificateWindow
UnityEditor.VersionControl.WindowChange
UnityEditor.VersionControl.WindowCheckoutFailure
UnityEditor.VersionControl.WindowPending
UnityEditor.VersionControl.WindowResolve
UnityEditor.VersionControl.WindowRevert
UnityEditor.Web.WebViewEditorStaticWindow
UnityEditor.Web.WebViewEditorWindow
UnityEditor.Web.WebViewEditorWindowTabs
UnityEditor.ProfilerIPWindow
UnityEditor.ProfilerWindow
UnityEditor.UISystemPreviewWindow

メモ

  • ほとんどのクラスは内部クラスなのでアクセスできません
  • アクセスしたい場合はリフレクションを使用します

参考サイト様

関連記事