+1 vote

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?

Godot version 3.3
in Engine by (56 points)

Is the phantom player_script.gd still attached to a node in your project?

It's attached to the Node2D

1 Answer

+1 vote

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:

  1. Remove the player_script.gd from the Node2D in the editor by right clicking the Node2D and selecting Detach Script.
  2. Replace the player_script.gd by creating a new player_script.gd in the res:// folder.
by (3,665 points)

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?

That's very strange. Try this:

  1. Move your player_script.gd completely out of your project folder -
    like to your desktop.
  2. Right click -> Detach Script on the Node2D that's giving you
    issues.
  3. Attach a brand new script to that same node.
  4. Copy the contents of your original player_script.gd (from step 1)
    into the new script that you just created.
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 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 webmaster@godotengine.org with your username.