EditorWindow in play mode

Hello there,

I have a class that extends EditorWindow. When I click on play when it is visible, it seems to be instantiated in the game context (I checked this using a Debug.Log in constructor), and its messing up my game.

I thought that the fact of living on a different namespace (UnityEditor), my EditorWindow would be skipped in the game context. Here is a sample code:

public class LDMainWindow : EditorWindow
{


    [MenuItem("Level Editor/Window/Level Design Window")]
    public static void OpenWindow()
    {
        LDMainWindow window = (LDMainWindow)EditorWindow.GetWindow(typeof(LDMainWindow));
        window.Show();
        window.Focus();
        window.title = "Level Editor";
        window.autoRepaintOnSceneChange = true;
        Debug.Log("Opening Level Editor window");
    }

    public LDMainWindow()
    {
        Debug.Log("LDMainWindow ctor");
    }

...

Can anybody help me on how to avoid this new instance?

Thanks

Could you explain how it is messing up your game? It doesn’t look like there is anything in your code that should affect gameplay.

I found out that the problem: all properties of my window MUST be able to be serialized…trying to do this now