void IterateThroughTreeDown(int lvl, ClassNode parent) { if (parent != null && lvl >= parent.GetWhenToUpgrade()) { techNext.SetActive(true); foreach (ClassNode nd in parent.GetChildren()) { GameObject nwRow = Instantiate(techRW, techNext.transform.GetChild(2)); RefreshTechPanel(nwRow, nd); UnityEngine.Events.UnityAction action = () => { instance.UpgradeSelected(nd); }; nwRow.GetComponent <Button>().onClick.AddListener(action); } } else { techNext.SetActive(false); } }