unity ui中使用onmouseover
2021-05-14 22:08
标签:tin lse deb reads 实现 不同 position mouse point unity ui中鼠标移进或者移出的触发方式与2d、3d的不同,2d、3d物体使用的是onmouseover,ui使用的是OnPointerEnter。需要实现以下两个接口。 原文出自unity官方论坛,详情可以查看https://forum.unity.com/threads/problem-with-onmousedown-onmouseover-in-ui.326096/ unity ui中使用onmouseover 标签:tin lse deb reads 实现 不同 position mouse point 原文地址:https://www.cnblogs.com/zhoushiya/p/12208548.htmlpublic class TrackMouse: MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
{
// Called when the pointer enters our GUI component.
// Start tracking the mouse
public void OnPointerEnter( PointerEventData eventData )
{
StartCoroutine( "TrackPointer" );
}
// Called when the pointer exits our GUI component.
// Stop tracking the mouse
public void OnPointerExit( PointerEventData eventData )
{
StopCoroutine( "TrackPointer" );
}
IEnumerator TrackPointer()
{
var ray = GetComponentInParent
上一篇:Java-天平称重
下一篇:Java基础语法-03
文章标题:unity ui中使用onmouseover
文章链接:http://soscw.com/index.php/essay/85721.html