The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

0 votes

Hi everyone,

the program works fine. I can click on the little script-icon next to its Node in the Scene-tree in the Editor, but it's nowhere to be found in ther FileSystem. This applies to a couple of scripts in my project. I'm confused, it's obviously there but...not really?

How can I make the scripts re-appear in their folders?

Godot version 3.2.3
in Engine by (525 points)

Is the script built into the node? The engine has a feature where a script can be embedded into a node.

I don't really know. In the Inspector the path leads directly to a scene...
Right-click - attach script is the way I do it.

If it's built into a node, is there a way to "extract" it? I like my scripts stored in their folders.

2 Answers

0 votes
Best answer

You probably stored your script(s) directly "in the node", or rather as an internal resource of the scene (when you open the .tscn file in a text editor, you should see the code).

To save the script as file, open the scene, click on the node in question, then in the inspector, go to the "Script" property and click on the little arrow to the right of the script, where you can select "Save" to save it like any other resource in Godot.

by (78 points)
selected by

As I mentioned in a comment below, I assume this directly-in-the-node storing happens when I accidently erase a folder with my files in it (which might have happened here) as a lucky backup, so the scripts don't really get lost? I wouldn't even know how do deliberately store one "in a node"...

But anyway, thank you, your hint is exactly what I was looking for!

Yes, that's a way for this to happen. You delete the underlying script files while still having the scene open, then save the scene again (all resources are still loaded in memory), and Godot will embed the scripts as resources into the scene.
On a related note, you should of course not rely on a "lucky backup" but make a proper (automatic) backup of all your important data regularly :)

Thanks for the insight. So if I'd close the Editor without saving the scene once more, the scripts would really be lost, I take it.

No worries, my drive is flooded with backups! ; )

0 votes

When You clicked on script icons, You must have already named new script and chose its path, before You could even create it. From that moment, they must have been placed in file system.
Maybe You are searching wrong, You know that scripts are*.gd and scenes are *.tscn ?

by (8,188 points)

Unfortunately I can't choose two answers as "best"...

You're right of course, and it ususally works fine. My theory in this case: I "cleaned up" the file folders a bit and I can imagine that I accidently "erased" some scripts, but then again, "not really", as it appears. So perhaps instead of a script getting lost completely (which would be bad) it then "bakes" into the scene? Sort of saves the day, I guess.

Thanks for your help!

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.