Hi,
I have an asset which needs to show a custom EditorWindow when the user first imports the asset. This has been working fine in 2018.4 - 2020 with the InitializeOnLoadMethod attribute but throws an exception in v2021.
public class MyWindow : EditorWindow
{
[InitializeOnLoadMethod]
public static void ShowMyWindow()
{
ShowWindow();
}
static public void ShowWindow()
{
var window = GetWindow(typeof(MyWindow), true, "My Window");
window.Show();
}
}
i’ve tried creating the window via " ScriptableObject.CreateInstance(typeof(MyWindow)) " but get the same issue.
When searching I can’t find anything that indicates why this issue is introduced in v2021, nor any way of solving it. It seems the window is not “ready” to be created when InitializeOnLoad fires.
The full error I get in Unity’s console is attached. Any ideas appreciated.
Many thanks,
shwhjw.
7552378–933760–error.txt (6 KB)