Godot 4.4 throws errors when using await
on EditorPlugin #100750
Open
Description
opened on Dec 22, 2024
Tested versions
- Reproducible: 4.4-dev1 and 4.4-dev7
- Not Reproducible: 4.3-stable
System information
Godot v4.4.dev7 - Windows 10 (build 19045) - Multi-window, 1 monitor - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1650 (NVIDIA; 32.0.15.6603) - Intel(R) Core(TM) i7-2600K CPU @ 3.40GHz (8 threads)
Issue description
When the editor starts up, calling code from an Autoload to an EditorPlugin with a function that uses while
and await
will result in either:
- Working fine.
- Throwing a Bad Address Index error.
- Throwing an Internal Script error with opcode 0, 1 or 99.
- Crashing to desktop.
Steps to reproduce
The MRP will throw the error when opening the project. If it doesn't, use "Project > Reload Current Project" as sometimes it may simply work.
This problem seems to require a combination of a few situations to happen:
- The EditorPlugin must be enabled. The issue vanishes when disabled, even if there are no changes in the script execution.
- The function must be called from the Autoloader to the EditorPlugin, if called from inside the EditorPlugin, it works fine.
- the EditorPlugin class must be loaded inside the function using
load()
. Works fine with a preloaded variable on the class scope. - The
await
must be inside thewhile
loop.
Some background on why I'm running code like this:
- To isolate editor access to only inside the EditorPlugin class.
- My plugin checks for a resource file, if it doesn't exist, creates the file and updates the FileSystem if it's in editor mode.
- After v4.2 or v4.3, the FileSystem takes a while to load and during that time any new files or requests to update are ignored.
- I can't use
preload()
because EditorPlugin classes are not exported to runtime.
Minimal reproduction project (MRP)
Metadata
Assignees
Type
Projects
Status
Unassessed
Activity