Answer the question
In order to leave comments, you need to log in
How to sort objects by their variables?
I have an object and it has a variable
public int CountTest = 1;
// объекты хранятся в массиве
public PrefabTest[] ArrayPrefabTest;
// то есть доступ до переменной
ArrayPrefabTest[0].CountTest = 1;
ArrayPrefabTest[1].CountTest = 15;
ArrayPrefabTest[2].CountTest = 3;
ArrayPrefabTest[3].CountTest = 30;
for(int i = 0; i < ArrayPrefabTest.Length; ++i){
if(ArrayPrefabTest[i].CountTest == ....
ArrayPrefabTest[3].CountTest = 30;
ArrayPrefabTest[1].CountTest = 15;
ArrayPrefabTest[2].CountTest = 3;
ArrayPrefabTest[0].CountTest = 1;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question