[Unity][UGUI]Tooltip提示框
发布日期:2021-05-09 11:55:30 浏览次数:4 分类:技术文章

本文共 613 字,大约阅读时间需要 2 分钟。

在Hierarchy视图,新建UICanvas,鼠标悬浮在UICanvas物体上,鼠标右键-UI-Image,新建一个UGUIImage物体,挂载Test_Toolstip.cs脚本

Test_Toolstip.cs脚本

.

using System.Collections;using System.Collections.Generic;using UnityEngine;using UnityEngine.EventSystems;//IPointerEnterHandler, IPointerExitHandlerpublic class Test_Toolstip : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler{    public void OnPointerEnter(PointerEventData eventData)    {        Debug.Log("Hello");    }    public void OnPointerExit(PointerEventData eventData)    {        Debug.Log("Bye");    }}
 

运行并测试,鼠标移动至UI上面,便反馈一个Hello,离开则Bye

接着完善Tooltip提示框的UI即可。

相关文章:

1.

2.

3. 

4.

5.

转载地址:https://blog.csdn.net/BuladeMian/article/details/79850082 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:[Unity][UGUI]跟随角色头顶的名字血条
下一篇:[资源分享]RPG源码分享

发表评论

最新留言

感谢大佬
[***.8.128.20]2023年08月31日 12时22分58秒