VerificationException EditorWindow.GetWindow

Hello, I’m getting the following VerificationException error:

VerificationException: Error verifying MyEditorWindow:OnEnable (): Function pointer signature 'object,bool' doesn't match delegate's signature 'object' at 0x014a
UnityEditorInternal.InternalEditorUtility:LoadSerializedFileAndForget(String)
UnityEditor.WindowLayout:LoadWindowLayout(String)

The line in question is:

EditorWindow.GetWindow (typeof (MyEditorWindow));

What could be causing this error and how can it be solved?

I just had a similar Exception. My problem was somewhat linked with default parameters.

public void MyMethod(Type parameter=DEFAULT_VALUE) { }

And I was calling this method through an Action without any parameter.

I just modified the method like this, and it just worked.

public void MyMethod() { MyMethod(DEFAULT_VALUE); }
public void MyMethod(Type parameter=DEFAULT_VALUE) { }

I guess you have declared an OnEnable method with a bool parameter in your EditorWindow. However the OnEnable callback of EditorWindow (which is inherited from ScriptableObject) doesn’t have any parameters. If you want to define a custom method, use a different name.