private void ClearCommanButtonsBreancher() { GameObject[] branchers = GameObject.FindGameObjectsWithTag("BtnBranchers"); foreach (GameObject brancher in branchers) { if (brancher.transform.parent == transform.parent) { ButtonBrancher bb = brancher.GetComponent <ButtonBrancher>(); for (int i = bb.buttons.Count - 1; i >= 0; i--) { Destroy(bb.buttons[i]); } bb.buttons.Clear(); } } }
void ClearCommonButtonBranchers() { GameObject[] branchers = GameObject.FindGameObjectsWithTag("ButtonBrancher"); foreach (GameObject brancher in branchers) { //check if the parent of this brancher is the same as the brancher we are currently looking at if (brancher.transform.parent == transform.parent) { //remove the brancher's buttons to keep things tidy ButtonBrancher bb = brancher.GetComponent <ButtonBrancher>(); for (int i = bb.buttons.Count - 1; i >= 0; i--) { Destroy(bb.buttons[i]); } bb.buttons.Clear(); } } }
void Start() { parentBrancher = transform.parent.GetComponent <ButtonBrancher>(); b = GetComponent <Button>(); GetObjectListening(); }
void Start() { parentBrancher = transform.parent.GetComponent<ButtonBrancher>(); b = GetComponent<Button>(); GetObjectListening(); }