godotengine / godotengine/godot
When I add a script file into the project tree and then open it with File > Open inside godot, it doesn't get added to the project and there is no prompt or button or context menu entry to do so
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
Latest stable on Flathub
### System information
Godot v4.2.2.stable - Freedesktop SDK 23.08 (Flatpak runtime) - Wayland - Vulkan
### Issue description
When I add a script file into the project tree and then open it with File > Open inside godot, it doesn't get added to the project and there is no prompt or button or context menu entry to do so. When I use it via `preload()` in some other place to refer to it, then I get a runtime error pretending the resource isn't there while the error lists the exact path of the file that does indeed exist.
This seems potentially like a UX/workflow design bug, where what the user wanted to do isn't really taken account of. I propose that there should be a prompt when I File > Open a script file that is inside the project folder but not registered as part of the project, to add it into the project. There should ideally also be an entry in the context menu of the file in the script file list to do so.
My apologies if there's a really obvious button to handle this and I somehow just missed it.
### Steps to reproduce
1. Make a new project with some scenes and script files
2. Outside of godot, make a new text file `myscript.gd` and copy it into the godot project folder on disk
3. Inside godot, go to the script pane and observe the script file isn't in the script file list, which is probably expected at this point. Click `File > Open` to add it to the open script file list.
4. Now observe the script file is listed amid the others with both 1. no obvious indication it wasn't properly added into the project, and 2. no obvious way to actually add it properly into hte project.
### Minimal reproduction project (MRP)
I sadly don't have one
Contributor guide
Research direction
Start by reproducing the workflow in the Godot editor: copy a new .gd file into the project, then use Script > File > Open and observe how it appears in the script file list. Review the project tree, script list, and related context-menu behavior. Done means an unregistered in-project script can be clearly added through a prompt or menu action and then resolves correctly when preloaded.
Written by the indexing model from the issue text.
Assessment
- Domain
- devtools, game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100