ShowBtnTip.cs 682 B

123456789101112131415161718192021222324252627282930
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.EventSystems;
  5. using XRTool.Util;
  6. public class ShowBtnTip : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
  7. {
  8. private Transform BtnTip;
  9. private void Awake()
  10. {
  11. BtnTip = UnityUtil.GetBreadthChild<Transform>(transform, "BtnTip");
  12. }
  13. public void OnPointerEnter(PointerEventData eventData)
  14. {
  15. if (BtnTip)
  16. {
  17. BtnTip.gameObject.SetActive(true);
  18. }
  19. }
  20. public void OnPointerExit(PointerEventData eventData)
  21. {
  22. if (BtnTip)
  23. {
  24. BtnTip.gameObject.SetActive(false);
  25. }
  26. }
  27. }