Loading non-standard asset files

I have a bunch of SVG files that I am using in my Unity app. I’m trying to work how to ensure that they are bundled with the application when it is built and what path I use to load them.

At the moment I’ve just been putting them in the Assets folder and using standard C# IO calls to read them. This works in the editor, but not in the build. Unity doesn’t seem to think they are used and doesn’t include them in the release version.

I’ve tried putting them in a ‘Resources’ folder, but that doesn’t see to do anything.

If you give the file a .txt suffix, it will appear in the project as a TextAsset which can be used much like any other asset. It is possible to get the raw bytes from a TextAsset too, so they can be used for binary data.

@andeeeee 10 years old! Cool idea in theory but it seems for most files changing the file type to “.txt” corrupts them.