using UnityEngine;
using System.Collections;
public class Script1 : MonoBehaviour
{
public float movespeed;
private Vector3 PresentPosition;
private Vector3 CurrentPosition;
void OnMouseDown()
{
PresentPosition= Input.mousePosition;
}
void OnMouseDrag()
{
CurrentPosition = Input.mousePosition;
Vector3 dir = CurrentPosition - PresentPosition;
transform.position += dir*movespeed;
PresentPosition = CurrentPosition;
}
void Update()
{
OnMouseDown();
OnMouseDrag();
}
}