void Retarget() { List <GameObject> flags = FlagUtils.FindAllEnemyFlags(transform.parent); if (flags.Count > 0) { // get random index in filtered array int index = Random.Range(0, flags.Count); targetPos = flags[index].transform.position; InfoBox.PrependLine("Retarget successful: " + index + " / " + flags.Count); } }