Topic was automatically imported from the old Question2Answer platform.
Asked By
slightly_seasoned
So I made a script for my player node [ aNode2D which has a KinematicBody2D as it’s child] & decided to redo it because it was too messy, & also because most of it wasn’t original [which brings my motivational levels down to the depths of hell.] So I deleted it in the file system, closed it, & started a new one. I finished the new player script, attached it to the player & this error popped up in the “Output” tab: modules/gdscript/gdscript.cpp:813 - Condition "err" is true. Returned: err Cannot load source code from file 'res://player_script.gd'. Failed loading resource: res://player_script.gd. Make sure resources have been imported by opening the project in the editor at least once.
What’s going on, & how do I fix it?
Is the phantom player_script.gd still attached to a node in your project?
The editor keeps meta-data about all of the different connections you make between resources (that’s how it builds your project when you go to run it) . During the startup process, it sees that you still have the player_script.gd attached to a Node2D but it fails to load the player_script.gd file from the operating system so it yells at you about it. Two solutions here:
Remove the player_script.gd from the Node2D in the editor by right clicking the Node2D and selecting Detach Script.
Replace the player_script.gd by creating a new player_script.gd in the res:// folder.
When I took it out of the folder it was in, it seemed to work. But when I put it back in it doesn’t. How do I fix this?
slightly_seasoned | 2021-05-09 01:19
That’s very strange. Try this:
Move your player_script.gd completely out of your project folder -
like to your desktop.
Right click -> Detach Script on the Node2D that’s giving you
issues.
Attach a brand new script to that same node.
Copy the contents of your original player_script.gd (from step 1)
into the new script that you just created.
Faced a similar problem.
Installed Asset… got a bunch of errors and removed it back.
The result is a ‘File not found’ error every time the project is run.
(Even though it was not connected anywhere)
Solution:
Throw the project folder into VSC and enter in the search the file that is not found.
In my case, I found a line (in [autoload]) containing:
After removing it, the problem, of course, disappeared.
For some reason, Godot does not have adequate options for working with Assets/Plugins, such as choosing the download path (everything flies to res://) or even just deleting downloaded Assets…