17 [SerializeField]
int StartId = 0;
18 [SerializeField] Button[] Buttons = null;
19 [SerializeField] GameObject[] ActiveIconGOs = null;
24 GameObject[] ButtonGOs = null;
29 ButtonGOs =
new GameObject[Buttons.Length];
31 for (
int i = 0; i < Buttons.Length; i++)
34 Buttons[i].onClick.RemoveAllListeners();
35 Buttons[i].onClick.AddListener(() => { OnValueChange(index); });
36 ButtonGOs[i] = Buttons[i].gameObject;
37 ButtonGOs[i].SetActive(i != StartId);
38 ActiveIconGOs[i].SetActive(i == StartId);
46 for (
int i = 0; i < ButtonGOs.Length; i++)
48 ButtonGOs[i].SetActive(i != index);
49 ActiveIconGOs[i].SetActive(i == index);
56 for(
int i = 0; i < ButtonGOs.Length; i++)
58 ButtonGOs[i].SetActive(i !=
id);
59 ActiveIconGOs[i].SetActive(i ==
id);
void OnValueChange(int id)
This is a custom implementation of a toggle group.