3dContactPointAnnotationTool开发日志(三三)

  添加背景图片后发现Runtime Transform Gizmo无法选中物体了:
1.png
  于是改了一下EditorObjectSelection.cs中的WereAnyUIElementsHovered函数:

private bool WereAnyUIElementsHovered()
{
    if (EventSystem.current == null) return false;

    Vector2 inputDevPos;
    if (!InputDevice.Instance.GetPosition(out inputDevPos)) return false;

    PointerEventData eventDataCurrentPosition = new PointerEventData(EventSystem.current);
    eventDataCurrentPosition.position = new Vector2(inputDevPos.x, inputDevPos.y);

    List<RaycastResult> results = new List<RaycastResult>();
    EventSystem.current.RaycastAll(eventDataCurrentPosition, results);
    //added by me
    int cnt = results.Count;
    foreach(var item in results)
    {
        if (item.gameObject.layer.Equals(Macro.BACKGROUND))
            cnt--;
    }
    return cnt != 0;
    //
    //return results.Count != 0;
}

  然后可以正常点击物体了:
2.png

posted @ 2019-01-17 18:32  菜鸟少侠  阅读(323)  评论(0编辑  收藏  举报