unity_browser icon indicating copy to clipboard operation
unity_browser copied to clipboard

mouse buttons not working on windows build

Open hoomanBT opened this issue 4 years ago • 2 comments

hi again! the mouse are completely functionally on editor (no problem at all) but on windows build mouse pointer are there and move around but all three buttons not working i'm using unity 2019.4.17.

hoomanBT avatar Feb 05 '21 07:02 hoomanBT

Hi. Changing rendering mode to "Screen Space - Camera" helped me. image

kusyk avatar Feb 15 '21 14:02 kusyk

Hi, it's me again. The solution above is not bad but in my project, I couldn't use this rendering mode so I had to rewrite this method to getting mouse position. I know, it is one big 'XD' but that was enough for my prototype. It is from WebBrowser2D.

` private Vector2 GetScreenCoords(GraphicRaycaster ray, StandaloneInputModule input) {

        RectTransform window = GetComponent<RectTransform>();

        Vector2 mouseOffset = new Vector2(Input.mousePosition.x - window.position.x, Input.mousePosition.y - window.position.y);
        mouseOffset.x /= window.lossyScale.x;
        mouseOffset.y /= window.lossyScale.y;
        mouseOffset.y = window.rect.height - mouseOffset.y;

        if (mouseOffset.x < 0 || mouseOffset.y < 0 || mouseOffset.x > window.rect.width || mouseOffset.y > window.rect.height)
            mouseOffset = new Vector2(-1, -1);

        return mouseOffset;

} `

kusyk avatar Mar 13 '21 00:03 kusyk