Example #1
0
 void Update()
 {
     if (isPickedItem == true)
     {
         Vector2 position;
         RectTransformUtility.ScreenPointToLocalPointInRectangle(canvas.transform as RectTransform, Input.mousePosition, null, out position);
         pickedItem.SetLocalPosition(position);
     }
     else if (isTipShow == true)
     {
         //控制提示面板跟随鼠标
         Vector2 position;
         RectTransformUtility.ScreenPointToLocalPointInRectangle(canvas.transform as RectTransform, Input.mousePosition, null, out position);
         tip.SetLocalPosition(position + new Vector2(10, -10));//后面加的是关于中心的的偏移
     }
 }