Strategy for dealing with custom file types..

I’m looking for a bit of direction here. I have created a custom plugin that needs to a load text files containing custom xml-type descriptors. For now I’ve been loading directly from a file path, but I obviously need a more generic way of doing this. I would love to be able to either:

  • drag and drop the file onto my Actor’s filename property, but the UE4 content browser won’t show the files as they are not standard asset types. I can’t believe the editor won’t list .txt files?
  • create some kind of file open dialogue, but there doesn’t seem to be a simple and standard way of doing this. The only option I found was to use the DesktopPlatform module, but that’s not included with the binary build package of UE4 it seems. I’m creating a plugin, so I don’t want the end-user to have to install extra modules to use it.
  • create a dropdown property that lists all files of particular type in the Assets folder. Doable I’m sure, but I can’t seem to find a way of creating a dropdown menu type of property component.

I have explored creating my own custom assets that wraps each of these xml files. But it seems like a lot of work for the end user as they would need to create a new custom asset and then copy and paste the xml text into the asset through the asset editor. Can anyone offer any help or guidance. Another thing I probably need to consider is how these files get packaged when it come to building the game? Does everything in the Assets folder get packaged? I’m guessing that if it is, it’s also only support file types that get bundled? Or?

This will allow you to select the path to a folder using a file open dialog in the editor (e.g. in the details panel for a placed actor etc.):

FDirectoryPath ...;

I’m fairly certain there’s an equivalent for actual Files but I can’t remember what it’s called (wild guess: FFilePath). Whether the file would be correctly included in a packaged build I’m unsure about. You could test that though.
If it isn’t included automatically a VERY simple way to deal with that would be to simply open the specified file directly in PostEditPropertyChange when the Path is modified and save its contents in an FString UPROPERTY. Probably not the best idea depending on how large the files are (more a quick-and-dirty way to test it).

Creating a new txt-type asset type and the importer for it should not be too difficult either. Take a look at the other importers to get an idea of how to set them up.

Boy am I sorry I didn’t I ask this question this morning! This is exactly what I was looking for. Easy when you know how I guess.