How can I get the data from text files located inside my assets?

Here’s my situation.

I would like to have text files located inside my assets. These are basically Notepad-editable “map” files.

How can I reference them so that I can take the data from the files and copy them elsewhere onto the user’s system?

The end result I’m after is that the game has the capability of reading map files from a Maps folder located on the user’s system. I want in-built maps to be “copied” to that folder on start up (to keep them intact/up to date) while still allowing people to put their own custom maps inside the same folder.

So in other words, I can’t figure out how to make reference to my internal .txt files and retrieve the string data from them. All the rest I know how to do. All I can seem to find about this are editor-related scripts, and I don’t think those are what I need.

If you store your files with a .txt extension then Unity will treat each file as a TextAsset, and you can uses Resources.Load to load them and textAsset.text to access them.

Alternatively, since you are creating a standalone build (I presume?) you can use standard System.IO.File calls for file manipulation, and you can find your data relative to Application.dataPath.