Godot Version
v4.3.stable.mono.official [77dcf97d8]
Question
In Unity, using MenuItemAttribute
, I could very easily add my own commands to the menu bar. To any section and subsection.
In Godot it turned out to be much more difficult.
I created a plugin and with the AddToolMenuItem
method I can add my commands to Project/Tools
.
But what if I want to add my commands to another section?
For example: My Project/Open Main Scene
?
#if TOOLS
#nullable enable
namespace Project {
using System;
using System.Collections;
using System.Collections.Generic;
using Godot;
[Tool]
public partial class ProjectBar : EditorPlugin {
public override void _EnterTree() {
AddToolMenuItem( "Hello World !!!", Callable.From( () => GD.Print( "Hello World !!!" ) ) );
}
public override void _ExitTree() {
RemoveToolMenuItem( "Hello World !!!" );
}
public override bool _HasMainScreen() {
return true;
}
}
}
#endif