.txt files not appearing in build. ,.txt file not appearing in build.

I’m currently making a Visual Novel in Unity. I’ve stored all the dialogue for my game in a series of .txt files. These are converted into a list of strings by a script called FileManager then transfers them to a script called NovelController, which interprets them as commands for the game. This works fine in the editor but for some reason it’s not working when I build the game. Unity keeps telling me that the .txt files do not exist, which is odd because I have it in the Resources folder. I’m currently using File.ReadAllLines from the System.IO Library to find and extract the files and I’m using Application.DataPath to adjust for different operating systems but it still not working. Does anyone have a solution to this?

A .txt-file in the Resource folder will be added as a Resource, not an actual file in the Application.DataPath folder.

A resource projectFolder\Resources\TextFilesFolder\file.txt can be read like this:

string filenameNoExt = "file"; //.txt is removed
TextAsset f = (TextAsset)Resources.Load("TextFilesFolder/" + filenameNoExt);
string fileText = System.Text.Encoding.UTF8.GetString(f.bytes);