Answer the question
In order to leave comments, you need to log in
List in unity. I can't figure out what a List is and how to use it??
I'm learning C# and noticed that List is often used, but I never understood what List is and how to use it.
I would like to know what List is, why it is needed and how it can be applied in Unity.
Answer the question
In order to leave comments, you need to log in
If, in a simple way, List is an array without a specific number of cells, you can constantly add them there. To wrap a list:
List <Переменная> name = new List <Переменная>();
//Например
List <Int> l = new List<Int>();//Лист , который будет содержать переменные типа Int
Working with such an array is very similar to working with ordinary one-dimensional and multidimensional arrays. Only adding to this array is done withname.Add(переменная);
//например
l.Add(1);//Добавляем в наш массив переменную со значением 1;
You can also do this with the help of cycles) I told you the simplest thing so that you understand at least a little. You yuopi threw off the link, there you will find everything else)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question