(C#) I have a question in relation to loading list of files from a directory. As I understand it after export files, such as scenes (.tscn), get moved to the .import folder and in its place a metadata file appears (.tscn.remap). If you're using DirAccess to iterate over files in a directory after export then you will get the metadata file instead and ResourceLoader will be unable to load as it had been in the Editor.
The possible solutions to this are:
- Trim the .remap suffix from the end of the metadata file when iterating through the directory which due to how the ResourceLoader works will be able to remap it correctly to the original file in .import. This is more due to a quirk in the engine than an intended solution but is very simple to implement.
- Manually create a list of all the files in the folder that need to be loaded and load that. This seems to be the "proper" yet cumborsome way to deal with it. I suppose you could create a tool of some kind to auto gather the files for you in a folder but there's an issue; you can't load files dynamically at runtime say if you were loading Mods. (At least as far as I can tell)
- Setting Project Settings > Editor > Export > Convert Text Resources To Binary to 'false' but I'm not exactly sure the consequences of disabling that are so for now I'm just avoiding it.
So I'm wondering if anybody knows any other/clean solutions to loading an arbitrary numbers of scenes from a folder at runtime, in my case I'm loading different Enemy Types from a folder called "Enemies".
This seems to be the main issue for this problem: 1