private void Update() { //使提示框和拖拽时出现的物体跟随鼠标 Vector2 position; RectTransformUtility.ScreenPointToLocalPointInRectangle(GameObject.Find("Canvas").transform as RectTransform, Input.mousePosition, ClickManager._Instance.FindEnableCamera(Camera.allCameras), out position); //把鼠标的屏幕坐标转换为UI的相对坐标 if (isdrag) { dragItemUI.show(); dragItemUI.SetLocalPos(position); //设置拖拽物体的坐标 } else if (isshow) { UI.show(); UI.SetLocalPos(position); //设置提示框的坐标 } }