I'm trying to make a mission system for my game, and I need to assign multiple Text files into an array of TextAssets. The easiest way to do this would be to loop through the directory which contains the files, and then assign them to the array. How would I do that?
You don't. Everything is done via the Inspector using references to assets. This way, Unity can optimize your game as much as possible (since reading and writing directories like that at runtime can be slow).
If you make a `public TextAsset` variable, you can fill that in using the Inspector.
But if you really want to read the assets from a directory, you can put everything into folders inside one of the special Assets folder, /Resources/. Everything in there will be included at runtime, so you can grab stuff out of there if you want to, like this:
TextAsset myAsset = Resources.Load("myTextFile.txt") as TextAsset;
"myTextFile.txt" needs to be in the Resources/ folder at that point. You can also use subfolders.