Button on Canvas not detecting the Mouse Position correctly

Hi! I have been working on a project recently, when I ran into a problem. I was working with buttons, and I realized that when I build my project as an executable, the application doesn’t seem to detect the mouse position correctly. Here’s a simple rundown:

I created a simple scene with a single button to demonstrate the issue. In this scene, I have a Main Camera, a Canvas with the Button, and an Event System. Here’s what they all look like:

The Canvas uses a Screen Space - Camera Render Mode with a Canvas Scaler component set to Scale with Screen Size, with a reference resolution of the standard 1080p.

Below is a demonstration of me running the simple scene in the editor. I move my mouse around, and the button reacts entirely normally. I started with a wider aspect ratio at 16:6 before switching to a standard 16:9 ratio to show compatibility as seen:

Next is where the problem comes in. So, I built the application with the standard Windows 64-bit architecture and opened the application in its folder. As you can see, when I run it in the application, the mouse detection is off, and the button doesn’t respond how it’s supposed to. Something I forgot to demonstrate was when I would shrink the application’s window down to 16:9 when I was running it, it would work almost completely normal, with no mouse position bugs. My big issue for my project in particular is how the button doesn’t detect input on its right side. This can be seen at the end of the gif. It’s like its detection is completely cut off.
alt text

Hopefully, there’s a solution to this tricky problem. I’d love to get back to work on my project again! Thank you! Let me know if you need any more information.

Maybe change the UI scale mode on the canvas scaler component on your canvas to “scale with screen size”?