unity read text file

C#
// This is how I read a textfile, contained within the Resources
// folder:
TextAsset textFile;
string text;
string[] lines;

textFile = Resources.Load(fileName) as TextAsset; // Loads file
text = textFile.ToString(); // Converts to string
lines = text.Split('\n'); // Splits per newline
// Do something with it
Source

Also in C#: