コード例 #1
0
 /// <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();
         }
     }
 }
コード例 #2
0
        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;
                }
            }
        }