Ok, I figured out the problem and the solution:
- My code was checking for and counting the .png files specifically:
if FileAccess.file_exists(path+".png"): return load(path+".png")
- As that actual file won't exist in an exported game, checking for the .import instead returns true on an exported project:
if FileAccess.file_exists(path+".png.import"):
- As the .import file also points to the correct resource,
load(path+".png")
still works
So, all I had to do was add ".import" to the checks of whether the file exists and everything worked. The idea to test that came after reading this issue *(plus another one I closed and can't find anymore) *and before I myself opened an issue complaining about the above. - https://github.com/godotengine/godot/issues/39746