using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.UI; using XRTool.Util; public class BackChooseToggle : MonoBehaviour,IPointerEnterHandler, IPointerExitHandler { private Transform BtnTip; private void Awake() { GetComponent().onValueChanged.AddListener(OnValueChanged); BtnTip = UnityUtil.GetBreadthChild(transform, "BtnTip"); } private void Start() { OnValueChanged(GetComponent().isOn); } private void OnValueChanged(bool value) { transform.GetChild(0).gameObject.SetActive(value); } public void OnPointerEnter(PointerEventData eventData) { if (BtnTip) { BtnTip.gameObject.SetActive(true); } } public void OnPointerExit(PointerEventData eventData) { if (BtnTip) { BtnTip.gameObject.SetActive(false); } } }