using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine; using UnityEngine.UI; public class ToggleGroupSelf : MonoBehaviour { public Color m_ActiveColor; public Color m_UnActiveColor; public List m_SelfToggles = new List(); // Start is called before the first frame update void Start() { foreach (Toggle item in m_SelfToggles) { item.onValueChanged.AddListener((b) => { item.GetComponentInChildren().color = b ? m_ActiveColor : m_UnActiveColor; item.GetComponentInChildren().fontSize = b ? 24 : 22; }); } } // Update is called once per frame void Update() { } }