UI Button hitbox is wrong

Godot Version

4.5.1

Question

When i place Buttons in my UI, the hitbox seems to be allways wrong, even if i create a really minimal example scene.

  • Control Node
    • Button Node (Anker to the middle of the screen)

I have to place my mouse around the red marked area to be able to click the button, or to trigger the hover.

Clicking on the Button directly dosen’t work.

What i am missing here?

I’m having the same issue as well. Are you on the version “v4.5.1.stable.official [f62fdbde1]”? You can find the exact version on the Project Manager, bottom right corner.

had it with 4.3 and 4.5
ive got v4.5.1.stable.official [f62fdbde1] now

Try putting it in a canvas layer and see how it behaves.

same Problem :frowning:

I remember that the problems was on the window, I don’t remember if it was on the mode, the stretch, etc. But changing one of those options fix the problem. Maybe your problem is different, but try that.

I’ve seen this happen in various places in windows; you can also IIRC see this behavior in Planescape Torment, among many other games. When I’ve seen it, it was because of windows UI scaling. If you set your windows scaling to 100%, there’s a good chance it “fixes” the problem.

Of course, if that’s the problem, the real fix is going to be a bit less simple.

2 Likes

Great game.


The only time I’ve seen this in Godot was with my game Skele-Tom. The problem was that I was displaying the menu in a 2D Viewport inside a 3D object (a TV) that was displaying the object at an angle because it was angled. So the mouse worked, but it was off - like what you’re describing.

Are you using any Viewports?

I tried some Example Projects and even there, ive got this bug. I also tried to work with viewports / subviewports etc.
Nothing seems to work.. maybe there is a problem with my gpu driver. I have a RTX 4090. I will try to update the drivers later.

See here a similar problem, which was apparently fixed by updating the GPU’s drivers. So I’d recommend doing that as well.

1 Like

Hi, just a quick friendly correction, I actually ended up just setting it to fullscreen in Project Settings > Window (:

Updatet the drivers, still the same issue. It works when i export the game, then the hitbox works as intendet. It just dosent work, if i run the scene out of the editor… Hm i really dont know why

What does your node tree look like?
(this)

It’s been bothering me for quite a while, but I finally found the solution… I noticed that when I select lower resolutions in the window settings, it works. I also noticed that older versions work as well.

For me, it was the debug toolbar… When I output the game in Full HD, it scales the window to fit the entire screen and the debug toolbar slides up. The window is then rendered correctly, but the UI hitbox shifts by the size of the toolbar. This also explains why it ultimately works in the exported game. Disabling this toolbar was the solution. (3 dots in the top right corner of the toolbar).

3 Likes

Yeah that toolbar is useless 99% of the time. I wish it was disabled by default.

1 Like