Moving a resource file in windows, like a scene file? "Failed to load resource" errors

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Arity

So I’m running Windows 10 (Godot 3.2.2.), I go out into the file explorer and re-organize my scene files there, and suddenly the game’s not working. Turns up some “failed to load resource” type of errors. So I move everything back to where it was originally, the game works fine again. Now. When I move the files around inside of the engine in the “filesystem” tab, everything works fine. Why? What is the engine doing when I move resources around in-engine that it isn’t doing when I do it in explorer?

p.s. Even when I load up the engine after moving things around in explorer, I would expect it to notice the changes and update the resource references accordingly… is this a missing feature or a bug on my end?

:bust_in_silhouette: Reply From: rakkarage

There are some drawbacks to this simple file system design. The first issue is that moving assets around (renaming them or moving them from one path to another inside the project) will break existing references to these assets. These references will have to be re-defined to point at the new asset location.

To avoid this, do all your move, delete and rename operations from within Godot, on the FileSystem dock. Never move assets from outside Godot, or dependencies will have to be fixed manually (Godot detects this and helps you fix them anyway, but why go the hard route?).

The second is that, under Windows and macOS, file and path names are case insensitive. If a developer working in a case insensitive host file system saves an asset as myfile.PNG, but then references it as myfile.png, it will work fine on their platform, but not on other platforms, such as Linux, Android, etc. This may also apply to exported binaries, which use a compressed package to store all files.

It is recommended that your team clearly define a naming convention for files when working with Godot. One simple fool-proof convention is to only allow lowercase file and path names.

“same” in unity

rakkarage | 2020-10-14 15:45