-
-
Notifications
You must be signed in to change notification settings - Fork 22k
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
Autoload scenes with a @tool script in the top node get loaded into the editor as a child of the root #71373
Comments
Well, tool scripts run inside editor. If you don't want it in the editor, why use tool? |
The issue is not that it's running in the editor, it's that it's creating an instance of the autoload on the root node (the editor window itself as opposed to normal behavior where tool scrips just run in the editor viewport). You can see in the example image I sent this results in the node appearing on top of the editor. This is avoidable by not creating an autoload tool script, but considering it can crash the editor on startup it should probably be looked at. |
A workaround is to add the following code in the
|
A bit of a necro-bump, but I encountered this issue just recently.
When scripting in C#, a That is, for configuration warnings to work, I need an instance of a For context, I'm working on a project where we have a autoloaded "persistent scene" where things we wish to persist get reparented before switching scenes. This scene has a script with a number of referenced child nodes. Having custom configuration warnings for ensuring everything is set up correctly is quite useful for this use-case. However, things get funky when the persistent scene has the default player instance, and the main camera following the player is a child of the default player instance. This breaks the editor when the persistent scene gets initialized as child of the editor root window: Here, the persistent scene has been set up as I was able to work around this by getting rid of the editor-wide global instance as suggested in the workaround posted above. EDIT: Now that I'm done debugging what's going on, I think this would have been much less surprising if I had known that autoloaded |
Well, that's wrong. |
Godot version
3.5.1.stable, v4.0.beta10 (d0398f6)
System information
Linux Mint 21.1
Issue description
If you mark a scene with a tool script in the root node as an autoload, it will actually be loaded into the editor. This happens as soon as the scene is marked as an autoload, and also every time you open the editor.
If there's an error in the script, the editor will crash every time it opens, requiring you to edit the script with an external editor to fix it.
It looks like this:

Tested in both
3.5.1.stable
andv4.0.beta10 (d0398f62f)
Expected behavior was for the scene to only be loaded when the game was actually running.
Steps to reproduce
Minimal reproduction project
project.zip
The text was updated successfully, but these errors were encountered: