I have a game object on hierarchy and a script attached to game object.
I couldnt reach the lines in function OnBeginDrag.
What am I possibly doing incomplete?
#pragma strict
import UnityEngine.EventSystems;
var itemDragged : GameObject;
var startPosition : Vector2;
function Start () {
}
function Update () {
}
class dirag extends MonoBehaviour implements IBeginDragHandler,
IDragHandler,
IEndDragHandler
{
function OnBeginDrag (eventData :PointerEventData)
{
itemDragged=gameObject;
startPosition = transform.position;
Debug.Log (gameObject.name + " " + startPosition);
}
function OnDrag (eventData :PointerEventData)
{
transform.position= Input.mousePosition;
}
function OnEndDrag (eventData :PointerEventData)
{
itemDragged=null;
transform.position = startPosition;
}
}