Hi guys,
im trying to create a list of all the childs, and while it is created i want to check if the list turns out to be null.
Take a look please:
void Update () {
if (GM.gameprogress == activeAt) {
active = true;
int i = 0;
List<GameObject> children = new List<GameObject>();
foreach (Transform child in transform) {
if (child.gameObject.layer == 27) {
child.gameObject.SetActive (true);
children.Add(child.gameObject);
} else {
child.gameObject.SetActive (false);
}
}
//THIS PART DOES NOT WORK
if(children == null){
active = false;
GM.gameprogress += 1;
}
//
}
}
So in my Game I have a gameobject with lets say 2 childs, as soon as those childs are destroyed the list should return null to set the gameprogress +1 stuff.
Can anyone enlighten me?
THank you Guys!