Skip to content

Instantly share code, notes, and snippets.

@SiarheiPilat
Created November 23, 2019 20:38
Show Gist options
  • Save SiarheiPilat/35d04556132e5ef6739fe5ba37e44b5c to your computer and use it in GitHub Desktop.
Save SiarheiPilat/35d04556132e5ef6739fe5ba37e44b5c to your computer and use it in GitHub Desktop.
using UnityEngine;
using UnityEditor;
using System.Reflection;
public class InternalEditorWindowsChecker : MonoBehaviour
{
/// <summary>
/// Most built-in editor windows in Unity are internal classes, so we can't access them directly.
/// However, we can work around that using Reflection.
/// The following code returns all editor window types, including internal classes (default Unity editor windows) and custom editor windows that are found in loaded assemblies.
/// Reference: https://answers.unity.com/questions/1237463/how-do-i-get-a-reference-to-the-default-editor-win.html?_ga=2.133529742.1822843399.1574452927-44739247.1572947128
/// </summary>
/** Internal editor windows that are returned in 2019.1.2f1:
* UnityEditor.BuildPlayerWindow
* UnityEditor.ConsoleWindow
* UnityEditor.IconSelector
* UnityEditor.ObjectSelector
* UnityEditor.ProjectBrowser
* UnityEditor.ProjectTemplateWindow
* UnityEditor.RagdollBuilder
* UnityEditor.SceneHierarchySortingWindow
* UnityEditor.SceneHierarchyWindow
* UnityEditor.ScriptableWizard
* UnityEditorInternal.AddCurvesPopup
* UnityEditor.AnimationWindow
* UnityEditor.CurveEditorWindow
* UnityEditor.MinMaxCurveEditorWindow
* UnityEditor.AnnotationWindow
* UnityEditor.LayerVisibilityWindow
* UnityEditor.AssetStoreInstaBuyWindow
* UnityEditor.AssetStoreLoginWindow
* UnityEditor.AssetStoreWindow
* UnityEditor.AudioMixerWindow
* UnityEditor.Collaboration.CollabPublishDialog
* UnityEditor.Collaboration.CollabCannotPublishDialog
* Unity.Experimental.EditorMode.EditorModeViewer
* 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.EditorTools.EditorToolWindow
* UnityEditor.SnapSettings
* UnityEditor.TreeViewExamples.TreeViewTestWindow
* UnityEditor.GUIViewDebuggerWindow
* UnityEditor.InspectorWindow
* UnityEditor.PreviewWindow
* UnityEditor.AddShaderVariantWindow
* UnityEditor.AddComponent.AddComponentWindow
* UnityEditor.IMGUI.Controls.AdvancedDropdownWindow
* UnityEditor.LookDevView
* UnityEditor.Experimental.Networking.PlayerConnection.AttachToPlayerPlayerIPWindow
* UnityEngine.XR.WSA.HolographicEmulationWindow
* UnityEditor.FrameDebuggerWindow
* UnityEditor.SearchableEditorWindow
* UnityEditor.LightingExplorerWindow
* UnityEditor.LightingWindow
* UnityEditor.LightmapPreviewWindow
* UnityEditor.NavMeshEditorWindow
* UnityEditor.OcclusionCullingWindow
* UnityEditor.PhysicsDebugWindow
* UnityEditor.TierSettingsWindow
* UnityEditor.SceneView
* UnityEditor.SettingsWindow
* UnityEditor.ProjectSettingsWindow
* UnityEditor.PreferenceSettingsWindow
* UnityEditorInternal.SpriteEditorMenu
* UnityEditor.SpriteEditorWindow
* UnityEditor.Sprites.PackerWindow
* UnityEditor.SpriteUtilityWindow
* TroubleshooterWindow
* UnityEditor.UIElements.UIElementsEditorWindowCreator
* UnityEditor.UndoWindow
* UnityEditor.Connect.UnityConnectConsentView
* 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.Experimental.GraphView.SearchWindow
* UnityEditor.LicenseManagementWindow
* UnityEditor.ParticleSystemWindow
* UnityEditor.Presets.PresetSelector
* UnityEditor.ProfilerWindow
* UnityEditor.UISystemPreviewWindow
* UnityEditor.ShortcutManagement.ConflictResolverWindow
* UnityEditor.ShortcutManagement.DeleteShortcutProfileWindow
* UnityEditor.ShortcutManagement.PromptWindow
* UnityEditor.ShortcutManagement.ShortcutManagerWindow
* UnityEditor.SketchUpImportDlg
* UnityEditor.TerrainWizard
* UnityEditor.ImportRawHeightmap
* UnityEditor.ExportRawHeightmap
* UnityEditor.TreeWizard
* UnityEditor.DetailMeshWizard
* UnityEditor.DetailTextureWizard
* UnityEditor.PlaceTreeWizard
* UnityEditor.FlattenHeightmap
* UnityEditor.GridPaintPaletteWindow
* UnityEditor.GridPaletteAddPopup
* UnityEditor.UIAutomation.TestEditorWindow
* UnityEditor.UIElements.Debugger.PanelDebugger
* UnityEditor.UIElements.Debugger.UIElementsDebugger
* UnityEditor.UIElements.PainterSwitcherWindow
* UnityEditor.UIElements.Debugger.AllocatorDebugger
* UnityEditor.UIElements.Debugger.DrawChainDebugger
* UnityEditor.UIElements.Debugger.UIRDebugger
* Unity.PackageManager.UI.Window
* UnityEditor.TestTools.TestRunner.TestRunnerWindow
* UnityEditor.Graphs.AnimatorControllerTool
* UnityEditor.Graphs.LayerSettingsWindow
* UnityEditor.Graphs.ParameterControllerEditor
* UnityEditor.Graphs.AnimationStateMachine.AddStateMachineBehaviourComponentWindow
* UnityEditor.Android.AndroidKeystoreWindow
* UnityEditor.Timeline.TimelineWindow
* TMPro.TMP_ProjectConversionUtility
* TMPro.TMP_SpriteAssetImporter
* TMPro.EditorUtilities.TMPro_FontAssetCreatorWindow
* UnityEditor.PackageManager.UI.PackageManagerWindow
* UnityEditor.CollabHistoryWindow
* UnityEditor.CollabToolbarWindow
* TMPro.TMP_PackageResourceImporterWindow
**/
public static Type[] GetAllEditorWindowTypes()
{
var result = new List<Type>();
Assembly[] AS = AppDomain.CurrentDomain.GetAssemblies();
Type editorWindow = typeof(EditorWindow);
foreach (var A in AS)
{
Type[] types = A.GetTypes();
foreach (var T in types)
{
if (T.IsSubclassOf(editorWindow))
result.Add(T);
}
}
return result.ToArray();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment