godotengine / godotengine/godot

EditorPlugin._Build() base implementation returns 'false' (Godot C#)

Open
#112,012 1 comment 0 reactions 0 assignees View on GitHub
bug confirmed topic:dotnet
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

-Reproducible in: 4.3.0, 4.4.1, 4.5.1

### System information

Windows 11 (build 26100) - Multi-window, 2 monitors - OpenGL 3 (Compatibility) - NVIDIA GeForce RTX 3060 (NVIDIA; 32.0.15.6094) - AMD Ryzen 9 7950X 16-Core Processor (32 threads)

### Issue description

A standard practice for C# is to call the underlying implementation of a virtual method that is not abstract, so as to ensure that you are extending, not overriding, functionality unless you intend to do so explicitly, and that doing so will result in the same behavior as the base class.

The EditorPlugin script virtual function _Build()'s base implementation returns 'false', which means 'build failed for plugin'.

Because of this, and because of how Godot hooks into Godot-C# crossover objects like Nodes, despite the following being by-standard identical to not overriding the method at all, it will cause the build to fail in the editor:
`public override bool _Build()
{
base._Build();
}
`
Just by overriding the function then calling the base implementation, the class has reversed it's behavior for the function.

The result is very surprising and runs counter to language and convention standards. The base class should return 'true' to avoid such a scenario and maintain correctness by programming conventions.

### Steps to reproduce

-Create an EditorPlugin C# class & plugin file
-Override _Build() and add 'base._Build();
-Enable the plugin
-Breakpoint on base.Build()
-Click 'Run Project' and observe that the value returned is 'false'. The build will fail.
-Optionally, remove the override and then observe that the build succeeds.

### Minimal reproduction project (MRP)

N/A (any C# plugin will work)

Contributor guide

Open the contributing guide

Research direction

Start by locating the Godot C# EditorPlugin._Build() base implementation and review how the editor handles its return value during a plugin build. Reproduce the issue with a C# EditorPlugin that overrides _Build() and calls base._Build(), then run the project. Done means this override no longer causes the plugin build to fail, while the existing no-override behavior remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, godot
Domain
game-dev, tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.