Images loaded by code not loading in exported build

Use ResourceLoader.exists in place of FileAccess.file_exists for checking the existence of a file or resource in the “res://” virtual directory.

Why?

On export, Godot will convert resource files to binary like “.tscn” → “.scn”, image files to a texture format like “.png” → “.ctex” and store them in a special directory “.godot” or packed structure “.pck”.

ResourceLoader is aware of these conversions and remaps original paths to their converted path.

2 Likes