UI Button click Position different to actual position

Hey,

I’m using unity 5.1. I have a problem with the Button click position.

If I run the project on my native resolution which is 1920x1200 everything is fine but as soon as I choose a different resolution, the actual click on a Button is completely wrong.
It is like the Button is drawn at x=10 y=10, but the click is not the same position as the button. so to click the button I have to click in empty space. What can that be? Seems like a mouse transformation bug, and I do not use own code. I use the onclick handler of the UI Button element.

Can someone help me?

I have the same issue. I guess the game stretches to fit your screen without "remapping" the mouse input. Consider using the native resolution or play in windowed mode.

Hi What I got from you question is Button is remaining at the same position as it was... If this is the problem then pls set the anchor points at proper position sot that they components retain their position. Second If there is any other problem then please post the screenshots both correct one with 1920x1200 resolution & second screenshot with incorrect button

When i have normal monitor resolution 1600 x 900 [52060-juego-2015-08-14-17-43-59-76.jpg|52060] when i have 800x600 and first put window mode true and later false and return i see this [52061-juego-2015-08-14-17-44-19-28.jpg|52061] the all buttons not work i use this code first start on full screen 1600x900 later use this Screen.SetResolution(800,600,false); and later use this Screen.SetResolution(800,600,true); and the buttons not work

Hi Thanks for the screenshot now what I am getting from the screenshot is they are scaled down when you change the resolution of the monitor. can you please confirm this. you have to set the properties of the canvas like this [52181-screen-shot-2015-08-17-at-31632-pm.png|52181] Please message if this work or not ..

i try this solution and have same problem :(

2 Answers

2

I tested everything and it is definitely a bug. I created a new scene, added a UI button and a click handler and problem still exists. So its no third party sourcecode its unity. Buttons appears on the right position. But the actual click is on different position. I used no source.

So i’m guessing its a bug. It doesnt appear if I choose the exact same resolution I developed the game with in playmode.

Check the following link, I think some other peoples are also facing the same problem answers.unity3d.com/questions/1028964/unity-5-new-ui-button-colliders-moved-to-the-left.html

Namaskaram,

In my case, its was a text mesh pro button object down in the hierarchy. That was causing the same issue.

Hope it helps someone.