I'm trying to fill a dropdown with a lis,t if some input is correct.
now when trying to create the list from a text file (to save the program) i should split the line on a comma so i have 3 settings for one asset: For ex asset1,colour,used,broken. the list should show the asset if the item is broken (0 is not broken, 1 is broken).
public string[,,,] UsedAssetList;
string[] lines = System.IO.File.ReadAllLines(@"" + Application.persistentDataPath + "/assetlist.txt");
cmbAssetNumber.ClearOptions();
for (int i = 0; i < lines.GetLength(0); i++)
{
UsedAssetList = ***lines[i].Split(',')***;
if (UsedAssetList[i,0,0,1] == "1")
{
list = new Dropdown.OptionData(UsedAssetList[i,0,0,0]);
cmbAssetNumber.GetComponent<Dropdown>().options.Add(list);
}
}
The lines[i].Split(',')
gives me the error:
Error CS0029 Cannot implicitly convert type 'string[]' to 'string[*,*,*,*]'
I think everything is on point, except the filling of my list. any idea on how i can get this right?
EDIT: I was thinking the list should look like this: {{"asset1","Gold","1","0"},{"asset2","Green","0","1"} , ... }
EDIT: While the text file looks like:
asset1,Gold,1,0
asset2,Green,0,1
...