What are the entries after the square brackets when you Debug.Log a list with “subentries” called?
Debug.Log(exampleList[indexVariable].theEntryAfterTheSquareBracket);
What are the entries after the square brackets when you Debug.Log a list with “subentries” called?
Debug.Log(exampleList[indexVariable].theEntryAfterTheSquareBracket);
Not sure I understand the question, but potentially you are referring to an array of arrays? (or list of lists)
MyLists[1][0] would grab the first entry in the 2nd list in MyLists (which is a list of lists!)
This touches on what I am talking about. I think. ![]()
sooo with entry after the square bracket you mean, the thing after the dot?
as in:
x[y].z
you want to know what z is?
after a dot you access any exposed/public variables, methods etc of an object or class
if you have a list of objects, the square brackets will simply return you one object within that list, at the specified position
lets say you have defined class “Car” where every car has a public variable “color”, and the class “Car” has a Constructor that intakes a Color and writes it to the “color” variable
and lets say you make a list of cars like
List<Car> cars = new List<Car>();
cars.Add(new Car(Color.red));
cars.Add(new Car(Color.blue));
cars.Add(new Car(Color.green));
then
cars[0]
will output an object of the type “Car”
on this object you can read the “color” of the car using .color
so
cars[0].color will output Color.red
in other words, the .theEntryAfterTheSquareBracket has nothing to do with the list or the square brackets, you could very well do:
Car firstCar = cars[0];
Debug.Log(firstCar.color);
instead of
Debug.Log(cars[0].color);
both do exactly the same
Not what i was looking for, but thank you for bringing that up.
Yep, that’s it. I thought there was some specific term for that specifically for lists.