-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
_init function of autoload executes when opening editor #19935
Comments
They are instanced in editor and added to script globals, so they can be easily referenced in scripts. If this is really an issue I can change the system to avoid it. |
So it's just for the purposes of auto-complete? Hmm. I would suggest removing it, if only to prevent potential issues later. There are already some issues that may be related to this, but I haven't been able to pin down if this is the exact cause:
|
And static checks. But I guess it only needs to be compiled, not instanced. I'll disable the instancing for non-tool scripts then. |
BTW, if you are preloading things in the script, they will be loaded if the script is loaded, even if it's not instanced. So I don't think it's possible to avoid the issues, in this case you should not use |
Wasn't the idea also that autoloads should be available in the editor for the use of tool scripts? |
Yes, but it only works properly if the autoload is also a tool script. |
Hello everyone (who's still kicking it after 6 years), I have a dbcontroller class (SQLite) that is used by a few EditorScripts of my own. Is this controller's _init function running when I open the editor, just because it is referenced in an EditorScript? Thanks for the clarification in advance, best regards |
Godot version:
Current Master
OS/device including version:
Arch Linux, updated recently™
Issue description:
The
_init
function runs in singleton scripts are running the editor opens. This isn't really a problem as for singletons,_init
is effectively_ready
, but I do find it a little strange.Minimal reproduction project:
singletontest.zip
If you open Godot from a terminal, you will see it print "WHY DID I RUN". It does not appear inside godots UI as it runs before the godot editor is open.
The text was updated successfully, but these errors were encountered: