txt file line endings differ from policy settings

Hello there,the question/problem is quite simple, i have a txt file with 5 lines of text (random crap ) separated by one blank line. I made the txt file in the windows notepad and then imported it into unity. Now the thing is that when i run this simple code:

	public TextAsset txt;
	string[] text;
	void Start () 
         //here i just split the text file into a string
         //array, separated by two "new lines" (




         // and here i just try to print the length of the new array
         // to check if it splitted correctly
	     Debug.Log (text.Length);

As the txt file has 5 lines, the code should print 5, but it doesn’t.
The problem is that when i open the txt file in monoDevelop to modify it, when saving
it says “line endings differ from policy settings” , with a button that says “correct it” and “keep changes” (basically do nothing and save what i modified). It doesn’t matter what i modified, but the thing is that if i press “correct it” then the code print 5 as it should be, if not it keeps saying 1.

Now sorry for the long explanation but the question is why is that happening ? i know that i can modify the policy of monodevelop and change the lane endings from unix to microsoft windows, but that just stops the warning from pop up, it doesn’t resolve the problem ( the code says 1 instead of 5 ).

Is there a way to solve it ? so i can just make a txt file, import it into unity and dont have to “correct it” every time i import a new txt file ? its not a big deal since its just pressing a button, but it annoys me the fact that i have to do it with every new txt file. Thanks and sorry for the long explanation.


text = Regex.Split(txt.text,"\\r?\ "); or

text = Regex.Split(txt.text,"(\\r?\ ){2}");

or whatever correct regex is to cover all possible line endings.