Godot Version
4.7.stable
Question
I making editor plugin with autoload singleton like this:
func _enable_plugin() → void:
add_autoload_singleton(“PnCEditorConnector”, “res://addons/quest-editor/editor/pnc_editor_connector.gd”
And i want to access this autoload in _ready of my node:
func _ready() → void:
PnCEditorConnector.reactiveProject.get_ids_list(type)
But whene I restart plugin (disable/enable) i get error:
Trying to access non-existent autoload singleton “PnCEditorConnector”.
When I restart whole editor there is no error.
After some testing i know that in the same place
EditorInterface.is_plugin_enabled(‘quest-editor’)
returns true
So there is time window where plugin is enabled but autoload is not initialized yet.
Is there better place to access autoload than _ready
or I have to add timeout:
await get_tree().create_timer(.1).timeout;
before accessing autolaod?