I’m trying make a script that turns a string it reads from a .txt file into a usable color variable. When I press the play button unity freeze’s and I have to close it and restart it. Here is the script can someone help me out and tell me whats wrong?
import System.IO;
function Start(){
var sr : StreamReader = new StreamReader(Application.dataPath + "/data/playerData.txt");
line = sr.ReadLine();
while(line != null){
if(line.StartsWith("RGBA(")){
var s = line.Substring(5).Split(")"[0]); //i think it has to do with this
var values = s[0].Split(","[0]);
var color : Color = Color(float.Parse(values[0]), float.Parse(values[1]), float.Parse(values[2]), float.Parse(values[3]));
print(color);
}
}
sr.Close();
}