Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections.Generic;
- using System.Linq;
- using UnityEngine;
- using System.Collections;
- using UnityEngine.UI;
- public class CustomTabs : MonoBehaviour
- {
- public List<CustomTab> _customTabs;
- public ToggleGroup _toogleGroup;
- public List<CustomTab> GetListCustomTabs()
- {
- return _customTabs;
- }
- void Start ()
- {
- if (_toogleGroup == null)
- _toogleGroup = GetComponent<ToggleGroup>();
- }
- void Update ()
- {
- if (_toogleGroup == null)
- return;
- if (_toogleGroup.AnyTogglesOn())
- {
- int length = _customTabs.Count;
- for (int i = 0; i < length; i++)
- {
- CustomTab tab = _customTabs[i];
- tab.Active = false;
- }
- Toggle activeTab = _toogleGroup.ActiveToggles().First();
- if (activeTab != null)
- {
- CustomTab group = activeTab.GetComponent<CustomTab>();
- if (group != null)
- group.Active = true;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement