Hello,
I wanted to make a custom editor window so I followed examples on how to do it. And even resorted to copying the exact examples when it wasn’t working.
But the window option appears in the drop down menu correctly however whenever I click on it the whole unity editor crashes.
I looked through error.log and it states:
Unity.exe caused an Access Violation (0xc0000005)
in module Unity.exe at 0023:00fa80e7.
Read from location fdfdfdfd caused an access violation.
I know that fdfdfdfd is almost definitely a fill pattern so there is uninitialized data somewhere but I’m not sure what I am doing wrong.
I also know that if I don’t call EditorWindow.GetWindow() it doesn’t crash (It also doesn’t do anything, which is expected)
My Entire code is as follows:
using UnityEngine;
using UnityEditor;
public class MyWindow : EditorWindow
{
// Add menu named “My Window” to the Window menu
//C Sharp:
[MenuItem(“Window/My Window”)] //This is the place that the option to create the window will be added.
public static void ShowWindow() //Don’t change the name of the function
{
EditorWindow.GetWindow(typeof(MyWindow)); //If you disobeyed this article and named your class something else, replace the ‘MyWindow’ in this line with that name.
}
void OnGUI()
{
}
}