Why does the following script fail to get data from a CSV file? When I debug, it gives me a length of 1, whereas there are over forty lines in the CSV. When I attach the script to Unity, it skips every line past the “for” statement (I assume this is because it keeps reading the length as 1). I pasted the first few lines from the CSV after the script.
string[] data = scenarioInfoTextFile.text.Split(new char[] { '
’ });
Debug.Log(data.Length);
for (int i = 1; i < data.Length - 1; i++)
{
string row = data*.Split(new char { ‘,’ });*
if (row[0] != “”)
{
names q = new names();
q.sceneNumber = int.Parse(row[0]);
q.sceneYear = int.Parse(row[2]);
etc…
2,Tutorial,1939,9,0,19390900,Tutorial,1000,2000,3000,no
3,1939 – Wielun,1939,9,1,19390901,1939 – Wielun,2000,3000,5000,no
4,1939 – Piotrkow,1939,9,2,19390902,1939 – Piotrkow,2000,3000,5000,no
etc…