Is there a way to open a new instance of an EditorWindow so you can have multiple instances of that EditorWindow open?
GetWindow and CreateInstance both seem to return existing EditorWindows, only allowing you to make one instance…
Is there a way to open a new instance of an EditorWindow so you can have multiple instances of that EditorWindow open?
GetWindow and CreateInstance both seem to return existing EditorWindows, only allowing you to make one instance…
This can be achieved using EditorWindow.CreateInstance
like demonstrated below:
using UnityEngine;
using UnityEditor;
public class MultiWindow : EditorWindow {
[MenuItem("Window/Multi Window")]
static void ShowWindow() {
MultiWindow window = CreateInstance<MultiWindow>();
window.title = "MultiWindow";
window.Show();
}
void OnGUI() {
}
}
Once you have created your classes: Window1 Class
using UnityEditor;
using UnityEngine;
public class Window1 : EditorWindow {
}
Window2 class
using UnityEditor;
using UnityEngine;
public class Window2 : EditorWindow {
}
You can call them from your MainWindow class:
using UnityEditor;
using UnityEngine;
public class MainWindow : EditorWindow {
void OnGUI()
{
}
//Add menu item named "My Window" to the window menu
[MenuItem("Window/Tool")]
public static void Init()
{
Window1 eventsWindow = (Events)EditorWindow.GetWindow(typeof(Window1));
Window2 banksWindow = (Banks)EditorWindow.GetWindow(typeof(Window2));
}
}//end class