TextAsset.text field is always null even though file is not empty
Ive tried every solution I could find so far, but nothing seems to be working. Im trying to load a text file with string pairs like "alice,bob", and the text file is accordingly just a list of pairs. But when I run this code
public TextAsset txt;
void parse()
{
Debug.Log("Parsing vocabulary data for " + txt.name);
print(txt.text);
string[] lines = txt.text.Split('\n');
Debug.Log(lines[0]); //just to test if the file even outputs anything
foreach (string line in lines)
{
string[] temp = line.Split(','); //split by ',' into temporary array
vocab[0].Add(temp[0]);
vocab[1].Add(temp[1]);
}
Debug.Log("Paring finished, vocabulary initialized :)");
}
I have my file in the assets folder of my project, and ive put it into the public txt field in the editor, yet when I run and try to read it as a string the string is always empty, even though the file most certainly is not.
I tried manually reading the filepath and using a reader to parse it but still the same issue arises.
Your answer
Follow this Question
Related Questions
How to create Gradient material and one side transparent 1 Answer
Mac JDK error on build 2 Answers
Unity beta 5.5 not building? 1 Answer
Unity Ads rewarded video no result, Android 1 Answer
Google+ in Unity. Is it possible? 0 Answers