unity Event Trigger事件

笪健
2023-12-01

//检测鼠标是否在UI上
public void PointerEnter()
{
print("进入UI ");
}

public void PointerExit()
{
    print("退出UI");
}
//在UI上按下,即使在UI外抬起也会调用PointerUp,但是在UI外抬起不会调用PointerClick
public void PointerDown()
{
    print("鼠标按下");
}

//鼠标按下事件  在PointerDown执行顺序之后
public void initializePotentialDrag()
{
    print("initializePotentialDrag");
}
public void PointerUp()
{
    print("鼠标抬起");
}

public void PointerClick()
{
    print("鼠标在UI上抬起");
}
//拖拽UI
public void Drag()
{
    print("拖拽中");
   
    this.transform.position = Input.mousePosition;
}

public void BeginDrag()
{
    print("开始拖拽");
}

public void EndDrag()
{
    print("结束拖拽");
}

//未知
public void Drop()
{
    print("在另一个UI抬起");
}

//在UI上时滚动滑轮
public void Scroll()
{
print(“滑轮滚动”);
}

#region
//Dropdown 、多个Toggle、多个Button等 选中事件

public void Select(BaseEventData evt)
{
    print("被选中");
}

public void UpdateSelected()
{
    print("被选中每一帧");
}

public void Deselect()
{
    print("取消选中");
}

#endregion
public void Move()
{
    print("按方向键");
}

//用在Dropdown下拉框打开关闭
public void Submit()
{
    print("Enter");
}

public void Cancel()
{
    print("Esc");
}
 类似资料: