-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Autoloaded singleton cannot be accessed at early phase during editor plugin start-up during editor start-up #77037
Comments
Related to #69387? |
(Ohh sorry. It was a question to me?) #69387 rather seems to be for cases, when someone try to use the Autoload name directly as global variable name from the same plugin script which makes the autoload. For this reason I use the get_node by purpose. My issue is not depending on whether autoload is added before plug-in start or not, but related to the godot engine start-up. From the error messages I assume not everything is set up yet in the engine, what is called during the plugin start-up. |
excuse me, have you found a workaround? @coderbloke |
I want to add some information to this. I would like this to get solved, but I understand it is somewhat intended/expected. The problemFor context, I've been developing a plugin called However as described by others before, all those references result in errors whenever the plugin is installed, but not yet activated. This is expected behaviour, but it is pretty annoying because:
There would be multiple ways to adress this: B) Existing workaroundThis is relatively easy to ignore. If you just enable the plugin and then restart godot the errors are usually gone. We have highlighted this BIG in our installation guide but we get weekly messages about "A lot of errors when installing" anyways. This is no problem for experienced users but it's pretty annoying for beginners. Minimal Reproduction ProjectI've provided a Minimal Reproduction Project. It contains a simple plugin that adds an autoload when enabled and has a script that uses this autoload. When opening the project you will get an error. |
Godot version
v4.0.1.stable.official [cacf499]
System information
Windows 11
Issue description
I have a editor plug-in. In "_enter_tree" it adds and autoload singleton + adds a Control to a dock.
The Control would come from the singleton.
The autoloaded singleton is not yet accessible just right after autoload, when:
No matter if autoload is already in the project setting, or added fo the first time by the plug-in
(Project open = Opening project.godot directly, not from project manager, but I assume it doesn't matter)
Not observed, when:
Error free even if singleton is removed from the autoload before enabling the plug-in.
Errors in console (when singleton is already added to the autoload during start-up, i.e. in previous session):
If plug-in is adding the single to autoload for the first time during start-up (i.e. singleton is not yet in autoload list in Project Settings) an additional error message is in the console BEFORE the above two:
This error with
add_child
is present, even, if I only have theadd_autoload_singleton
in the_enter_tree
.(Should I make separate ticket for this?)
Steps to reproduce
Create an editor plug-in similar to the one in description.
Have
add_autoload_singleton
andget_node
in_enter_tree
.Make another
@tool
script, which will be the singleton to load.Make the scenarios from description:
a) Open project.godot, with plug-in already enabled to project settings -> Error
b) Open project with disabled plug-in and -> No error
Further vary:
c) Singleton is already enabled in project setting's autoload before a or b
d) Singleton is removed from project setting's autoload before a or b
Minimal reproduction project
N/A
The text was updated successfully, but these errors were encountered: