Since I’m currently dealing with this problem, I’m gonna leave this info here, so anyone that comes across it knows what to do to fix it. Currently working on 4.1.1, should work on 3.x too
This is a problem that happens if you rename or delete files outside the Godot editor. Godot may warn you, or it may simply keep a cached copy and keep you completely unaware of it until you export the game and try to play it. It’s always a good thing to check for these once in a while.
Related questions:
- Remove *.import files if the original file does not exist in the folder anymore - https://github.com/godotengine/godot-proposals/issues/3582
- Godot recognizes that the file has been deleted outside the editor, but does nothing about it - https://github.com/godotengine/godot/issues/23105
HOW TO FIX:
- Create a dummy file, it can be
a.PNG
or whatever - Open the problematic scenes with a text editor
- Change the path of the offending files to the dummy. They’re usually at the top of the file, loaded as
[ext_resource type="Texture" uid="" path=res://graphics/missing.png" id="10_0y2mn"
- After saving, try to load the scene again. Be sure to run the Debug console version of Godot
- If everything went well, it should open. Delete the dummy file from within the editor.
If that doesn’t work, try this instead:
- Open the problematic scenes with a text editor
- Remove any lines that point to the offending files.
- Run the Godot with the debug console
- Attempt to open the scene in the editor. If it gives an error, check the debug console, the most likely error will be something like
res://scenes/problemscene.tscn:3815 - Parse Error: Can't load cached ext-resource id: 10_0y2mn
- Back in the text editor, look for that id within the scene. It’ll likely be something similar to
texture = ExtResource("10_0y2mn")
. Delete it - Repeat the last 2 steps until the errors stop.
if I get this error I just open the project in Visual Studio Code and remove the references manually. It’s dangerous and requires a bit of knowledge of the tscn format.