//是根据接口 PointerEventData 接口编写 ,是根据客户要求这么做的
// 废话不多说,直接上代码
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
public class NewBehaviourScript1 : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDragHandler
{
private Vector3 PlayPos;
public void OnBeginDrag(PointerEventData eventData)//点下
{
this.gameObject.GetComponent<CanvasGroup>().blocksRaycasts = false;
transform.SetAsLastSibling();
PlayPos = transform.localPosition;
}
private Vector3 global=Vector3.zero;
private Vector3 Pos;
// 拖动 相当于Update 每帧执行
public void OnDrag(PointerEventData eventData)
{
Vector3 globalMousePos;//定义一个三维坐标
if (RectTransformUtility.ScreenPointToWorldPointInRectangle(GetComponent<Rect