godot
godot copied to clipboard
[3.x] Try loading the path specified in a preload(..) method call with the ResourceLoader if the script code completion cache is not yet available
Fixes: https://github.com/godotengine/godot/issues/69360 Maybe related to: https://github.com/godotengine/godot/issues/35248 (Not sure as I didn't used an external editor, but the issue there sounds very similar)
This fixes the problem that autoloaded nodes could not be loaded because they (or there children) preload other nodes in their script. This was only happening on the start of Godot. When the autoloaded nodes will be resolved there is no code completion cache yet. Same is btw. done above, Line 552.
In editor_node:
- Line 6348:
ProjectSettingsEditor
is instantiated ->EditorAutoloadSettings
-> Autoloaded scenes will be created - Line 6985:
ScriptEditorPlugin
is instantiated ->ScriptCodeCompletionCache
will be instantiated
Note: Another possible fix here would be to initialize the ScriptCodeCompletionCache
(ScriptCodeCompletionCache::get_singleton()
) before resolving the autoloaded scenes.
Then the ScriptCodeCompletionCache
cache can be reused. (Order needs be changed in editor_node
)
Moving down the ProjectSettingsEditor
in the instantiation order (after ScriptEditorPlugin
) does work and everything looks normal. And the ScriptCodeCompletionCache
is created before the autoloaded nodes are created.
Note: This bug does not happen in Godot 4.0