Skip to content

Instantly share code, notes, and snippets.

@SiarheiPilat
Created November 23, 2019 20:57
Show Gist options
  • Save SiarheiPilat/82529aaf0b6614ba30f14cc6fe30145a to your computer and use it in GitHub Desktop.
Save SiarheiPilat/82529aaf0b6614ba30f14cc6fe30145a to your computer and use it in GitHub Desktop.
using UnityEngine;
using UnityEditor;
using System.Reflection;
public class ActiveEditorWindowValidator : MonoBehaviour
{
/// <summary>
/// Checks whether an active window is a window that you require, for example: ValidateEditorWindow("UnityEditor.AnimationWindow");
/// </summary>
bool ValidateEditorWindow(string EditorWindowType)
{
return EditorWindow.focusedWindow.GetType() != typeof(AnimationUtility).Assembly.GetType(EditorWindowType);
}
/** Internal editor windows that are accepted 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
**/
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment