UI面板拖放

来源:互联网 发布:发票网络认证系统 编辑:程序博客网 时间:2024/05/17 02:21
using UnityEngine;using System.Collections;using UnityEngine.UI;using UnityEngine.EventSystems;public class NewBehaviourScript : MonoBehaviour, IDragHandler, IPointerDownHandler, IPointerUpHandler{ public void OnDrag(PointerEventData eventData)    {        GetComponent<RectTransform>().pivot.Set(0, 0);        transform.position = Input.mousePosition;    }    public void OnPointerDown(PointerEventData eventData)    {        transform.localScale = new Vector3(0.7f, 0.7f, 0.7f);    }    public void OnPointerUp(PointerEventData eventData)    {        transform.localScale = new Vector3(1f, 1f, 1f);    }}

0 0