title: Cant find a way to clamp position of mouse when dragging sprite around the screen
body: <p>Hi I have a sprite that moves around the screen with left click of mouse, the problem I have is that the sprite can be dragged off scene.  I believe that the use of mathf and clamp but cannot figure how to insert it into this script.</p>
  
  <p>tried inserting  a basic mathf.clamp script on to sprite but the result was that the sprite would flick between the top and bottom of my clamp really quickly.</p>
  
  <pre><code>using System.Collections;
  </code></pre>
  
  <p>using System.Collections.Generic;
  using UnityEngine;</p>
  
  <p>public class DragMove : MonoBehaviour {</p>
  
  <pre><code>public GameObject gameObjectToDrag; // refer to Go that being dragged
  
  public Vector3 Gocenter; // gameobject centre
  public Vector3 touchPosition; // touch or click position
  public Vector3 offSet; // vector between touchpoint/mouse click to the object centre
  public Vector3 newGOCenter; // new center of object
  
  RaycastHit hit; // store hit object information
  
  public bool draggingmode = false; //   
  
  
  
  // Use this for initialization
  void Start () {
  
  }
  
  // Update is called once per frame
  void Update()
  {
  
      //********************************
      // **Click to Drag****************
      //********************************
  </code></pre>
  
  <h1>if UNITY_EDITOR</h1>
  
  <p>Thank you for any help</p>