unity3d:camera拖动与ui拖动互不影响

2023-08-24 14:34:26 浏览数 (2)

代码语言:javascript复制
 if (Input.GetMouseButtonDown(0))
            {
                if (Application.isMobilePlatform && Input.touchCount > 0)
                {
                    for (int i = 0; i < Input.touchCount; i  )
                    {
                        if (EventSystem.current.IsPointerOverGameObject(Input.GetTouch(i).fingerId))
                        {
                            m_isClickUi = true;
                            break;
                        }
                    }
                }
                else if (EventSystem.current.IsPointerOverGameObject())
                {
                    m_isClickUi = true;
                }
            }

            if (Input.GetMouseButtonUp(0))
            {
                m_isClickUi = false;
            }
            if (m_isClickUi == true)
            {
                return;
            }

当点下时ui时屏蔽镜头移动

0 人点赞