
实现代码如下:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
public class DragUI : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDragHandler
{
/// <summary>
/// UI和指针的位置偏移量
/// </summary>
Vector3 offset;
RectTransform rt;
Vector3 pos;
float minWidth; //水平最小拖拽范围
float maxWidth ; //水平最大拖拽范围
float minHeight;