Reading .txt file on Build

I want to read a TXT file on Build, but i’m having some problems like:

"ArgumentException: get_dataPath can only be called from the main thread.
Constructors and field initializers will be executed from the loading thread when loading a scene.
Don’t use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function.
getValue1…ctor ()
"

and

get_dataPath can only be called from the main thread.
Constructors and field initializers will be executed from the loading thread when loading a scene.
Don’t use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function.

I have only two lines on my code:

using UnityEngine;
using System.Collections;
using System.IO;
using System;
public class getValue1 : MonoBehaviour 
{	
	public string value1 = Application.dataPath+"/Resources/"+"readme.txt"; 
	void Update() 
	{

       print (value1);

    }
}

I need the value on build because de values will be dynamic and it need be on Update, please can someone help me ?

public string value1 = Application.dataPath+“/Resources/readme.txt”;

This line causes the problem. It’s an initializer, and basially a part of constructor.

So you either make value1 a property or initialize it in Awake() instead.

For example

public string value1
{
    get
    {
         return Application.dataPath+"/Resources/readme.txt";
    }
}

I use boo, not C#, so i might have some syntactic error there.

Use a condition, print only when a condition is true

public class getValue1 : MonoBehaviour
{
     public string value1 = "/Resources/readme.txt";
     bool printPath;
     void Start()
     {
       UpdatePath();
       printPath = false;
       print (value1);
 
     }

     public bool PrintPath
     {
         get{ return printPath;}
         set{ printPath = value; UpdatePath();}
     }

     void UpdatePath()
     {
         value1 = Application.dataPath + value1;
     }

     void Update()
     {
         if( printPath )
         {
             print( value1 );
             printPath = false;
         }
     }
}