Hi everyone,
I am new to unity and am learning to code in C#.
The 2D application i am developing in unity requires random short messages from a database to be displayed. I was wondering how i would code the script to read from a text file and extract the messages like:
msg.txt:
Hello!
Nice, looking good!
Take that!
…
Where each line can be in its own separate string (maybe in a string[ ]) The text file would be updated periodically so I would need to read from it.
I’ve searched the forums a bit and there are similar questions but in JS, so I attempted to modify some of it:
StreamReader f = new StreamReader(Application.dataPath/“Resources/msg.txt”);
string fileContents = f.ReadToEnd();
but that doesnt seem to work ![]()
So could anyone help point me in the right direction? ![]()