My game has options for player customization, it’s a number of .png files that are not loaded with the game startup, save for the default ones. Instead, if the player clicks a button, it will load the next file for that part (like, say, hair-2.png
)
This works fine on the editor, but I’ve just tested an exported version and it doesn’t work there, completely failing to find any files within the .pck. If I move the executable back to the project’s folder, it works as expected.
Trying to figure out the why, I’ve also exported via Export ZIP/PCK
, and found out it doesn’t actually export any of the .png files, it only exports the .import
files. The actual images are stored in the .godot/imported
folder, each with a long, random(?) string attached to their name: hair-1.png
becomes hair-1.png-t3g9r2he7783y9hut.tcex
I haven’t figured out a way to export the .png files as is, so what are my options here? Besides coupling all of the parts in a single image and separating it by frames of animation, which will require both code and art rework
Tested on both Godot 4.1.1 and 4.1.2-RC1
Ok, I figured out the problem and the solution:
if FileAccess.file_exists(path+".png"): return load(path+".png")
if FileAccess.file_exists(path+".png.import"):
load(path+".png")
still worksSo, 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