This question is based off of a previous one.
How to read a data from text file in unity
But I cant get the code to work for my purpose. I want to be able to choose which CSV files needs to be edited instead of just assigning one file.
Here is the code
private void readData()
{
TextAsset csvFile = Resources.Load("Assets/Resources/Test1.csv") as TextAsset;
string[] records = csvFile.text.Split(lineSeperater);
foreach (string record in records)
{
string[] fields = record.Split(fieldSeperator);
foreach (string field in fields)
{
contentArea.text += field + "\t";
}
contentArea.text += '\n';
}
I want to access the file using a given link and then write to it. but for some reason it keep saying "Object reference not set to an instance of an object" referring to "string[] records = csvFile.text.Split(lineSeperater);"
I'm new to coding so it might be missing something silly. but as far as i know it should make sense? as csvFile is given the usl, but the url is not being found when its searching for csvFile.text, but then again, i might be completely wrong.
Could someone maybe help me and guide me in the right direction?