http://www.manew.com/blog-1591-3367.html

   void Update()//检测鼠标.
    {

       
if (Input.GetMouseButtonDown(0) )
        {
           
if(MouseIsOnUI()==false)//不在UI上
            {
               
//这里才响应移动
            }
        }
    }
   
/// <summary>
   
/// 鼠标是否在UI上.
   
/// </summary>
   
/// <returns><c>true</c>, if is on U was moused, <c>false</c> otherwise.</returns>
   
bool MouseIsOnUI()
    {
       
if(UICamera.hoveredObject ==null )
        {
           
return false;
        }
       
else if(UICamera.hoveredObject != null)
        {
           
if(UICamera.hoveredObject.name=="UI Root" )
            {
               
return false;
            }
           
else
            {
               
return true;
            }
        }
       
return false;
    }