init
This commit is contained in:
commit
341a877b4a
2338 changed files with 1346408 additions and 0 deletions
30
Assets/Scripts/UI/DragAndDrop.cs
Normal file
30
Assets/Scripts/UI/DragAndDrop.cs
Normal file
|
@ -0,0 +1,30 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
public class DragAndDrop : MonoBehaviour, IPointerDownHandler, IBeginDragHandler, IEndDragHandler, IDragHandler{
|
||||
|
||||
[SerializeField] Canvas canvas;
|
||||
RectTransform rectTransform;
|
||||
|
||||
void Awake(){
|
||||
rectTransform = GetComponent<RectTransform>();
|
||||
}
|
||||
|
||||
public void OnBeginDrag(PointerEventData eventData){
|
||||
|
||||
}
|
||||
|
||||
public void OnDrag(PointerEventData eventData){
|
||||
rectTransform.anchoredPosition += eventData.delta / canvas.scaleFactor;
|
||||
}
|
||||
|
||||
public void OnEndDrag(PointerEventData eventData){
|
||||
|
||||
}
|
||||
|
||||
public void OnPointerDown(PointerEventData eventData){
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue