i'm trying to make a custom editor script for Unity, but i'm stuck in what I thought would be an easy step. When using UnityEditor.GetWindow(), the window doesn't open in the main tab but as a separate Window. The scene view is not attached to the main Unity window.
I've tried a few workarounds but none seem to work:
First I tried to use the desiredDockNextTo parameter from the API, but I keep getting an error i'm not able to fix.
Type inspWndType = typeof(Editor).Assembly.GetType("UnityEditor.SceneView");
EditorWindow[] allWindows = Resources.FindObjectsOfTypeAll<EditorWindow>();
Type[] insWindTypeList = new Type[allWindows.Length];
for(int i = 0; i < allWindows.Length; i++)
{
insWindTypeList[i] = allWindows[i].GetType();
}
var window = EditorWindow.GetWindow<typeof(inspWndType)>(insWindTypeList);
I keep getting an error in <typeof(inspWndType)> saying that it's a variable instead of a type (I also tried with inspWndType.gettype or casting it, nothing worked).
TLDR: I want to be able to create a window using EditorWindow.GetWindow() and dock it from a script.
Thank you to anyone that could help me with this.