public void OnCompileAndAddTypeButton(TypeCompilationSucceededEvent ev) { if (!ev.EditingAlreadyExistingType || (ev.EditingAlreadyExistingType && !CheckIfExistsInChildrenOfByTipeID(MBList.transform, ev.TypeID))) { GameObject classNameButton = Instantiate(ClassNameButton); classNameButton.transform.SetParent(MBList.transform); classNameButton.transform.GetChild(0).GetComponent <Text>().text = ev.TypeID; ClassNameButton temp = classNameButton.GetComponent <ClassNameButton>(); temp.TypeCode = ev.Code; temp.TypeID = ev.TypeID; } else { foreach (ClassNameButton btn in MBList.transform.GetComponentsInChildren <ClassNameButton>()) { if (btn.TypeID == ev.TypeID) { btn.TypeCode = ev.Code; } } } }
void Start() { _classNameButton = transform.parent.GetComponent <ClassNameButton>(); }