title: Mouse Drag in C# UNITY3D?
body: <p>I need to move a cube by clicking and dragging in C# Unity3D. My code currently creates the cubes by cilcking a button.</p>
  
  <pre><code>using UnityEngine;
  using System.Collections;
  
  public class CDraggable : MonoBehaviour 
  {
      Texture btnimg;
  
      // Use this for initialization
      void Start ()
      {
      }
  
      // Update is called once per frame
      Update () 
      {
          //here to write mousedrag code.
      }
  
      void OnGUI() 
      {
          if (GUI.Button(new Rect(400, 250, 50, 50), btnimg))
          {
              //Debug.Log("Clicked the button with an image");
              GameObject cube = GameObject.CreatePrimitive(PrimitiveType.Cube);
              cube.transform.position = new Vector3(-0.7F, 2, 0);
          }
      } 
  
  }
  </code></pre>