Problem with dragging objects

I have following script for dragging things:

using UnityEngine;
using System.Collections;

public class DragTile : MonoBehaviour {
//declaring some variables
	private bool mousedwn;
	void OnMouseDown() {
		if (!GameData.freemove){
			mousedwn = true;
	void OnMouseUp() {
		mousedwn = false;
	// Update is called once per frame
	void Update () {
		if ((mousedwn) && (Input.GetMouseButtonDown(0))){
			this.transform.Translate(Input.GetAxis("Mouse X"),0,Input.GetAxis("Mouse Y"),Space.World);

However it doesn’t work as planned. It works fine if I change

if ((mousedwn) && (Input.GetMouseButtonDown(0)))


if (mousedwn)

but then I can’t tell the difference between buttons. How can I fix it?




GetMouseButtonDown returns true ONLY for the frame when mouse button WAS CLICKED. So when mouse button changed its state to being pressed.