Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
public class DND : MonoBehaviour, IBeginDragHandler, IDragHandler
{
public Transform transform;
public Vector2 vector2;
private void Awake()
{
transform = GetComponent<Transform>();
}
public void OnBeginDrag(PointerEventData eventData)
{
Debug.Log("OnBeginDrag");
}
public void OnDrag(PointerEventData eventData)
{
Debug.Log("OnDrag");
vector2 = Camera.main.ScreenToWorldPoint(eventData.position);
transform.position = new Vector3(vector2.x, vector2.y, 0);
//transform.position = eventData.pointerCurrentRaycast.screenPosition;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question