Exemple #1
0
        private TabGroup FindTabGroup()
        {
            // The TabGroup is expected to be on the same object as the ToggleGroup.
            ToggleGroup toggleGroup = toggle.group;
            TabGroup    tabGroup    = toggleGroup.GetComponent <TabGroup>();

            return(tabGroup);
        }
Exemple #2
0
 private void EnablePage()
 {
     // If the page already exists, just activate it,
     // otherwise create it.
     if (Page != null)
     {
         Page.SetActive(true);
     }
     else
     {
         Page = GameObject.Instantiate(pagePrefab);
         TabGroup tabGroup = FindTabGroup();
         Page.transform.SetParent(tabGroup.TabPageParent, false);
     }
 }
Exemple #3
0
        void OnValidate()
        {
            // Awake probably hasn't been called yet, so set this here.
            toggle = GetComponent <Toggle>();

            // Make sure that this tab is part of a ToggleGroup.
            if (toggle.group == null)
            {
                Debug.LogError("Tab (" + gameObject.name + ") must be part of a ToggleGroup.");
            }

            // Make sure that the ToggleGroup has a TabGroup.
            TabGroup tabGroup = FindTabGroup();

            if (tabGroup == null)
            {
                Debug.LogError("Tab (" + gameObject.name + ")'s ToggleGroup must have a TabGroup.");
            }
        }