Search Unity

Showcase List of EditorWindow types for desiredDockNextTo parameter

Discussion in 'Scripting' started by JasonC_, Jun 6, 2021.

  1. JasonC_

    JasonC_

    Joined:
    Oct 27, 2019
    Posts:
    66
    Here is a list of window types for use with GetWindow's desiredDockNextTo parameter.

    https://docs.google.com/spreadsheet...LGSUYgWe1xtnxau8SiNBb1Gxcx1zG39cAf4K_/pubhtml

    Most of them are internal so you'd have to use reflection to get the Type from its name, e.g. something like:

    Code (csharp):
    1. //Type type = Type.GetType("Name.Of.The.Type, AssemblyName");
    2. Type type = Type.GetType("UnityEditor.ConsoleWindow, UnityEditor.CoreModule");
    The first column says "open" if the window already existed before I opened it; those are kind of the more common ones, I guess. Title text is in there if it was available; the titled ones are all listed first.

    Hopefully it is useful to somebody.

    --------

    It was generated with this code-vomit:

    Code (CSharp):
    1.         [MenuItem("Window/General/Data Dump")]
    2.         public static void ShowPanel () {
    3.  
    4.             // !!! set to true to try to create every window type (to pull window titles)
    5.             const bool TrashYourEditorForScience = false;
    6.  
    7.             using FileStream csvfile = new FileStream("windowtypes.csv", FileMode.Create, FileAccess.Write);
    8.             using TextWriter csv = new StreamWriter(csvfile, Encoding.UTF8);
    9.             csv.WriteLine("note,title,class,base class,assembly,errors");
    10.             var e = typeof(EditorWindow);
    11.             var hasopen = e.GetMethod("HasOpenInstances");
    12.             foreach (var a in AppDomain.CurrentDomain.GetAssemblies())
    13.                 foreach (var t in a.GetTypes())
    14.                     if (e.IsAssignableFrom(t)) {
    15.                         bool? alreadyopen = null;
    16.                         string title = null;
    17.                         List<Exception> errors = null;
    18.                         try {
    19.                             var hasopentype = hasopen.MakeGenericMethod(new Type[] { t });
    20.                             alreadyopen = (bool)hasopentype.Invoke(null, new object[] { });
    21.                         } catch (Exception x) {
    22.                             (errors ??= new List<Exception>()).Add(new Exception($"HasOpenInstances: {x.Message}", x));
    23.                         }
    24.                         if (alreadyopen == true || TrashYourEditorForScience) {
    25.                             try {
    26.                                 title = GetWindow(t).titleContent.text;
    27.                             } catch (Exception x) {
    28.                                 (errors ??= new List<Exception>()).Add(x);
    29.                             }
    30.                         }
    31.                         string note = (alreadyopen.HasValue ? (alreadyopen.Value ? "open" : "") : "?");
    32.                         csv.WriteLine($"{note},{C(title)},{C(t.FullName)},{C(t.BaseType.Name)},{C(a.GetName().Name)},{C(E(errors))}");
    33.                     }
    34.             csv.Flush();
    35.         }
    36.  
    37.         // good enough
    38.         static string C (object o) => $"\"{Convert.ToString(o).Replace("\"", "\"\"")}\"";
    39.  
    40.         static string E (IEnumerable<Exception> xs) =>
    41.             (xs == null) ? "" : String.Join("\n", new AggregateException(xs).Flatten().InnerExceptions.Select((x) => x.Message));
    And it made a mess:

     
    Last edited: Jun 6, 2021