godotengine / godotengine/godot
Autoloads in editor are loaded before GDExtensions
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
Godot v4.4.dev3 - Windows 10.0.19045 - Single-window, 1 monitor - OpenGL 3 (Compatibility) - NVIDIA GeForce RTX 4050 Laptop GPU (NVIDIA; 32.0.15.6070) - 13th Gen Intel(R) Core(TM) i5-13500HX (20 threads)
### System information
Godot v4.4.dev3 - Windows 10.0.19045 - Single-window, 1 monitor - OpenGL 3 (Compatibility) - NVIDIA GeForce RTX 4050 Laptop GPU (NVIDIA; 32.0.15.6070) - 13th Gen Intel(R) Core(TM) i5-13500HX (20 threads)
### Issue description
When in the editor and the editor initially starts up, autoload scripts are loaded before GDExtensions are initialized

I currently have this Autoload script that extends from my GDExtension class:
```gdscript
@tool # Ensures this singleton runs in editor
extends BopimoGame
```
This also seems to cause errors when exporting headlessly, it constantly spams prints from gdscript scripts about the gdextension classes not being found
### Steps to reproduce
- Create a script that references GDExtension classes
- Put the script as an autoload - make sure the @tool annotation is there so it can run in editor
- Notice the script can't compile because it doesn't know the GDExtension class
- Therefore the autoload won't load inside the editor
- Opening the project settings dialogue after the GDExtension has loaded recompiles (i think?) the script and then allows it to work inside the editor
### Minimal reproduction project (MRP)
see above
Contributor guide
Research direction
Reproduce the issue with an @tool autoload script extending a GDExtension class, then compare editor startup with opening Project Settings afterward. Trace the editor's GDExtension initialization relative to autoload loading and headless export startup. Done means the autoload resolves its GDExtension class on initial editor launch and headless export no longer emits repeated class-not-found errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- godot
- Domain
- devtools, game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100