Answer the question
In order to leave comments, you need to log in
How to process only occupied array elements?
I have an array with objects of this type
public class ClassTest {
private GameObject o; public GameObject Obj{ get{ return o; } set{ o = value; }}
......
}
private ClassTest ArrayTest = new ClassTest [100];
.....
for(byte i = 0; i < ArrayTest .Length; ++i){
if(i == 4 || i == 56) ArrayTest [i] = new ClassTest { Obj = SomeObj .... };
else ArrayTest [i] = null;
}
.....
for(byte i = 0; i < ArrayTest .Length; ++i){
if(ArrayTest [i] != null){ ....
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