Read TMX File as TextAsset

I’m creating a simple editor window to work as an automated map parser using a TMX file(from Tiled) as input and creating the whole thing using prefabs straight to the scene editor. I have a pretty good idea of how to do that already, with one little problem: I’m unable to open the TMX file as a TextAsset, because Unity seems to not recognize its extension as a valid TextAsset extension. So far the only way to access the file seems to be using C# standard library functions and accessing thee path directly which I think would be less than ideal(for one, I have no idea how that would work in different builds; but that’s a topic for later, if needed.)

So, cutting short to the question: is there a way for me to tell Unity to open TMX as a TextAsset in the same way it’d do an XML? Would I have to associate the extension to some custom asset type I’ll have to create for this?

There shouldn’t be any problem using System.IO.File to read the file in the editor. Alternatively, some people have put work in making their own custom format importers and build strongly typed representations with ScriptableObject derived scripts. I haven’t done so myself but it looks feasible.

However, if you also need to access the file contents at runtime in builds, you can place the file in StreamingAssets and load it from Application.streamingAssetsPath. Alternatively, you could write a build script which copies or renames the TMX files to txt files and keep using TextAsset.