Function File.fileExists
Returns true
if the file exists in the given path.
Note: Many resources types are imported (e.g. textures or sound files), and that their source asset will not be included in the exported game, as only the imported version is used (in the res://.import
folder). To check for the existence of such resources while taking into account the remapping to their imported location, use ResourceLoader
. Typically, using File
on an imported resource would work while you are developing in the editor (the source asset is present in res://
, but fail when exported).