godotengine / godotengine/godot

_Build() is not called on Build Project (Godot C#)

Open
#112,010 1 comment 0 reactions 0 assignees View on GitHub
bug needs testing 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

The EditorPlugin script function _Build() is not called when 'Build Project' is performed. It IS called, however, when 'Run Project' is performed. The behavior is very surprising and unexpected. It also leaves C# plugins without a reliable or practical way to clean up/shut down things gracefully without using reflection to bind to the GodotEditor build events.

If this is very intentionally the behavior for _Build(), then another method should be made available which does hook into Build Project, and _Build()'s documentation should be clarified.

### Steps to reproduce

-Create an EditorPlugin C# class & plugin file
-Override _Build() and add any content
-Enable the plugin
-Breakpoint on said content
-Click 'Build Project' in the editor, and observe that the breakpoint is not hit
-Optionally, then click 'Run Project' and observe that the breakpoint IS hit

### Minimal reproduction project (MRP)

N/A (any C# plugin will work)

Contributor guide

Open the contributing guide

Research direction

No source files or tests are named. Start at the EditorPlugin _Build() entry point and trace the editor's Build Project and Run Project paths, comparing when each invokes the hook. Done means the intended behavior is established and either the hook works for Build Project or its documentation and an alternative hook clearly cover the case, with regression coverage if available.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, godot
Domain
build-system, devtools, game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.