Unity - Read text file from external source

I’m trying to read a file in Unity from external source with no luck. To be more clear i can easily read and write on file with StreamWriter and StreamReader while i’m developing the game. The problem is that after build game don’t want to read the file anymore. The problem is that in the build i have no more the Resource folder neither the position.txt file. So i tried to put the file under c: calling the function in this way

> ReadFromFile(@"C:	est\position.txt");

It still works under developement but not after build

This is the code i’m using during development and it works

string path = Application.dataPath+"/Resources/position.txt";
 ReadFromFile(path);
 public  bool ReadFromFile(string fileName)
{

    try
    {
        string line;
        StreamReader theReader = new StreamReader(fileName, Encoding.Default);

        using (theReader)
        {

            do
            {
                line = theReader.ReadLine();

                if (line != null)
                {

                string[] entries = line.Split(',');
                switch (entries[0])
                {
                    case "1":
                        Console.WriteLine("Case 1");
                        cube1 = GameObject.Find("Cube1");
                        cube1.GetComponent<Renderer>().material.color = Color.red;
                        StartCoroutine(RotateCoroutine(new Vector3(0, 90, 0), 2.0f, cube1));

                        break;
                    case "2":
                        Console.WriteLine("Case 2");
                        cube2 = GameObject.Find("Cube2");
                        cube2.GetComponent<Renderer>().material.color = Color.red;
                        StartCoroutine(RotateCoroutine(new Vector3(0, 90, 0), 2.0f,cube2));
                        break;
                    case "3":
                        Console.WriteLine("Case 3");
                        cube3 = GameObject.Find("Cube3");
                        cube3.GetComponent<Renderer>().material.color = Color.red;
                        StartCoroutine(RotateCoroutine(new Vector3(0, 90, 0), 2.0f, cube3));
                        break;
                    default:
                        Console.WriteLine("Default case");
                        break;
                }

                }
            }
            while (line != null);
            theReader.Close();
            return true;
        }
    }
    catch (Exception e)
    {
        Console.WriteLine("{0}

", e.Message);
return false;
}
}

Can someone give me some hints to make it work?

You can use Application.streamingAssetsPath instead of the Resources directory if you want to read the text file using StreamReader at runtime.

Alternatively you can use Resources.Load to access files from the Resources directories at runtime, like so:

var textAsset = Resources.Load<TextAsset>("position");
var text = textAsset.text;´