The statements within foreach loop are never executed - but i dont’t know, why. It seems to be, that never any child is found. I don’t get any errors.
void Update()
{
float propability = Time.deltaTime * shotsPerSeconds;
if (Random.value < propability)
{
Fire();
}
if (AllMembersDead())
{
//Debug.Log("Empty Formation");
}
}
bool AllMembersDead()
{
foreach (Transform childPositionGameObject in transform)
{
if (childPositionGameObject.childCount > 0)
{
return false;
}
}
return true;
}