Why do I get a length of 1 when getting data from a CSV file?

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…

I think I see what you’re trying to do with splitting by
. I recently was working on something with a .tsv source and instead of splitting using text.Split, I used this File.ReadAllLines Method (System.IO) | Microsoft Learn File.ReadAllLines() function to split my file’s lines. It worked really well for me as I could then iterate through every line and split the line into an array of strings using the Split() function. Maybe try:

    Debug.LogWarning($"Processing catalogue.csv...");

    string[] lines = File.ReadAllLines($"{Application.dataPath}{csvPath}");

    for (int l = 0; l < lines.Length; l++)
    {
        string[] splitData = lines[l].Split(',');
        //Do something with the split data
    }