/// <summary> /// Deactivates attached object's children (recursively if applicable) /// </summary> public void DisableChildren() { foreach (Transform child in transform) { GameObject childObject = child.gameObject; childObject.SetActive(false); ToggleChildrenEnabled childToggle = childObject.GetComponent <ToggleChildrenEnabled>(); if (childToggle != null) { childToggle.DisableChildren(); } } }
void OnEnable() { ToggleEnabled answerToggle = answer.GetComponent <ToggleEnabled>(); ToggleChildrenEnabled resultsToggle = results.GetComponent <ToggleChildrenEnabled>(); if (answerToggle != null) { answerToggle.DisableObject(); } if (resultsToggle != null) { resultsToggle.DisableChildren(); } foreach (Transform optionTransform in options.transform) { Button option = optionTransform.GetComponent <Button>(); if (option != null) { option.interactable = true; } } }