How can you make new editor windows in Unity 3.5? I copied the following code straight out of the docs, and yet when I press ‘My Window’, nothing opens up. So has something changed scripting wise, or is there something wrong with my Unity?

class MyWindow extends EditorWindow {
    @MenuItem ("Window/My Window")
    static function ShowWindow () {
        EditorWindow.GetWindow (MyWindow);
    }

    function OnGUI () {
        // The actual window code goes here
    }
}

try to call “.Show()” method for the returning EditorWindow. might be a bug for JavaScript in 3.5. In C# it is calling the .Show() method whether or not you’re calling it, whenever you’re calling EditorWindow.GetWindow().

Make sure that your UnityScript file is named “MyWindow.js”. The fact that the file and class name have to match is also a requirement for “ScriptableObject” from which “EditorWindow” is derived from.

Usually your example should work, but I don’t use UnityScript, C# only :wink:

Does your OnGUI contain any gui? Maybe the window is just too small / offscreen / docked as tab somewhere. You can also try EditorWindow.GetWindowWithRect with a rect that is reliably visible.

Also like @Aeless mentioned try using the .Show( ) method on your window instance.

Aeless