+1 vote

I broke Godot and I don't wanna restart the whole project :( It worked ten minutes ago, I renamed Sprite to Player Sprite and forgot to change it in my script, crash of course, so I changed it in my script, still crash, I reversed everything as it was before and it's still crashing

    if velocity.y < 0 and not is_on_floor():
    $Sprite.play("Jump")
elif velocity.y > 0 and not is_on_floor():
    $Sprite.play("Fall")

Breakpoint at this line: $Sprite.play("Fall") since Sprite is no longer found. :|

enter image description here

Godot version 3.3.2
in Engine by (163 points)
edited by

Hi,
godot chrashes? or throws an error?
What does the error say?

I added an Image to my post, my game crashes not Godot...since it can't find the sprite, deleted all my sprites, created a new AnimatedSprite still crash.

can you post the error that has been thrown?
Look into errors!

When you type into the editor a string with $ the editor should give you a list of available objects in the tree. When the object you are refeering to isnt present in the tree the editor will give an error into the console while evaluating your script. Since that does not happen (i guess) the $Sprite you are refeering to must be present in the editor but not on runtime.

When I type $ in my editor, Sprite is available. What you see on my image is done via auto complete. I don't get an error at all, only this Breakpoint and game freeze,

That is strange .. it literally says there is a breakpoint. But i see no breakpoint statement in your code.
Have you closed godot and reopened the project?

Do you have another Script with the name Player.gd?

No, only this player, already restarted, even deleted the whole animation sprite and redone everything. Still doesn't work anymore.

I dont think the problem comes from $Sprite its more likely its this Player.gd script.
Copy the source of Player, delete the script.
Then create a new script on the Player and paste in your code.
Maybe its some weird script caching going on.

Okay I copied the content of my script, deleted the entire script file from my project, created a new one, pasted and it works now, finally. Thank you,

1 Answer

0 votes

Solution: I copied the content of my script, deleted the entire script file from my project, created a new one, pasted and it works now, Thank you, Klaas!

by (163 points)

The reason why this worked is because there was a break point. To remove a break point is by clicking on it, but deleting a script and making it again would also remove it.

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.