Godot permanently caching outdated script file paths?

Godot Version

4.3

Question

I’ve been fiddling around with Godot a bit this week, and today I ran into a bunch of errors where files will break the parser if I move them from their original location. After hunting a bit, I found the global_script_class_cache, but found that the files were actually correct there already. So, now I’m left a bit lost on how to fix this. I’ve searched the whole .godot directory for the outdated path string, with no results. Can anyone possibly point me to where this outdated reference might be stored so I can fix it? Apologize if this is some extremely basic problem or whatever, I’ve searched around a bit but wasn’t able to find any answers.

Just realized it’s the actual path missing the actions dir.

1 Like

Ah, sorry, I probably should’ve provided slightly more context, I’m too in my own head apparently.

The file in question declares class_name BattleAction. It was previously located in BattleEngine/actions/BattleAction.gd, but I then moved that up a folder and renamed it to be consistent, so it went from BattleEngine/actions/BattleAction.gd to BattleEngine/battle_action.gd. But for some reason, it continues to look in the old location, even though the path is correct in global_script_class_cache, which is the only place I can find the paths being referenced at all.

And at the risk of being too overly basic, you can bet I tried restarting Godot. :sweat_smile:

You can simply delete the .godot folder, and on next startup of the project, it’ll be regenerated.

2 Likes

:man_facepalming:
Thank you! This works! But…why? Are global class paths cached somewhere other than global_script_class_cache? I just wanna understand what went wrong here.

I know nothing about this to be honest, as far as I know, the .godot folder is responsible for keeping track of project resources and cache.

There’s a long explanation in the Godot 4.4 beta-1 release notes under breaking changes for UIDs on this and how they fixed it going forward.

2 Likes

This is exactly what I was looking for! Thank you so much!

Err, okay, maybe spoke too soon. :sweat_smile: Deleting the .godot folder works, but not in all cases. If I start my test scene directly, there is no error; however, if I load the scene and add it to the scene tree later, it gives me the exact same error referencing the old path.

I’m guessing 4.4 will fix this, so it’s not the end of the world to put the script back where it used to be until a stable build is available.

Shooting in the dark but what if it’s a meta import File of an actual asset, that is not in the .godot folder.

I looked around and I didn’t find any suspicious files, so I feel like it’s gotta be a totally unrelated import file if that’s what it is… Which would be really weird since .gd files aren’t tracked that way… But I’ve really got no other idea at this point.

2 Likes