"Main Screen" plugin events only fire when a menu is open

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By jhaines

I’m developing a plugin that has a main panel.

I followed the “Making main screen plugins” tutorial found at Making main screen plugins — Godot Engine (stable) documentation in English

I added an Area2D scene as an instance to the main_screen. The Area2D implements mouse enter/exit event to toggle color. enter=Green/exit = White

The Area2D event only fire if i have a menu item like “Scene” or “Project” open.

When a menu item is NOT open no events fire.

What am I missing?

addons/my_plugin
plugin.cs
main_panel.tscn
main_panel.cs
MyArea2D.tscn
MyArea2d.cs

The main_panel.tscn has 1 instance of MyArea2D.tscn. After enabling the plugin you can see the Main Screen with the MyArea2 instance. But when hovering over the MyArea2D with the mouse the mouse_entered event is NOT fired.

If you open the “Scene” menu and leave it open and then hover over the MyArea2D then the mouse_entered even is fired.

plugin.cs
using Godot;
using System;

[Tool]
public class plugin : EditorPlugin
{
PackedScene MainPanel = null;

main_panel main_panel_instance = null;

public override void _EnterTree()
{
    MainPanel = GD.Load<PackedScene>("res://addons/my_plugin/main_panel.tscn");
    main_panel_instance = MainPanel.Instance() as main_panel;
    // Add the main panel to the editor's main viewport.
    GetEditorInterface().GetEditorViewport().AddChild(main_panel_instance);
    // Hide the main panel. Very much required.
    MakeVisible(false);
}

public override void _ExitTree()
{
    if (main_panel_instance != null)
            main_panel_instance.QueueFree();
}

public override bool HasMainScreen()
{
    //return base.HasMainScreen();
    return true;
}

public override void MakeVisible(bool visible)
{
    if (main_panel_instance != null)
            main_panel_instance.Visible = visible;
}

public override string GetPluginName()
{
    return "Main Screen Plugin";
}


public override Texture GetPluginIcon()
{
    return GetEditorInterface().GetBaseControl().GetIcon("Node", "EditorIcons");
}

}

MyArea2D.cs
public class MyArea2D : Area2D
{
float _radius = 10f;

    Color _color = Colors.White;
    bool is_mouse_over = false;
    public override void _EnterTree()
    {
        var collision = GetNode<CollisionShape2D>("CollisionShape2D");

        var shape = new CircleShape2D();
        shape.Radius = _radius;
        collision.Shape = shape;

        if(!IsConnected("mouse_entered", this, "on_mouse_entered"))
            Connect("mouse_entered", this, "on_mouse_entered");
        
        if(!IsConnected("mouse_exited", this, "on_mouse_exited"))
            Connect("mouse_exited", this, "on_mouse_exited");

        Update();
    }


    public override void _Draw()
    {
        base._Draw();

        var color = Colors.White;

        if(is_mouse_over)
        {
            Modulate = Colors.Green;
        }
        else
        {
            Modulate = Colors.White;
        }

        DrawCircle(Vector2.Zero, _radius, _color);
    }

    void on_mouse_entered()
    {
        is_mouse_over = true;
        GD.Print("mouse entered");
        Update();
    }


    void on_mouse_exited()
    {
        is_mouse_over = false;
        GD.Print("mouse exited");
        Update();
    }
}