Hello!
I am using a custom list that provides a string value and a bool value.
I want to populate the string values with string from a CSV, and want to set the bool value to TRUE when the string is read. Now, I have a problem: how to refer to my custom list?
Before the custom list, I was using a normal list, and my code was:
List<Dictionary<string,object>> data = CSVReader.Read (csvData);
for (var i = 0; i < data.Count; i++)
{
csvStringList =data [“message”].ToString ();
}
How can I deal with my new custom List?
(I’m using @troien code: Re-orderable object lists in inspector - Questions & Answers - Unity Discussions)
In that code you use, I’m using a normal C# List… With in the Unity editor some sort of wrapper to make it easier to edit this list in the inspector. But the actual list used is still a normal C# generic List. To see how you can add things to this list, look at how I do it in the code…
listExample.list.Add(new ListItemExample());
Assuming you are using C#.
Considering the example code. I’m not sure what your question is here, I think that your actual question is ‘how do I instantiate a class?’. Correct me if I’m wrong. (If so, you should read about constructors).
For the quick answer, this tutorial should cover everything you might not understand I think
If you want to get a response on Unity Answers more quickly btw. It might help to include more code (you did include what you did before, whichis good, although you didn’t format it (you can use the 101 button when writing text to format code) and as a result it also looks like you are missing some parts… List > data
is I guess List<string>
data??? or is this javascript/unityscript? Because calling javascript from C# and vice versa is a different question). But what you do or try to do now (doesn’t matter if it doesn’t work) is also good to add, as then people might spot what you might be doing wrong, or might understand the question better…