- Home /
Strange behavior on Cursor
We are overriding the default windows cursor in our game, but have been noticing this behavior for a while.
The cursor change works 100% of the time when playing windowed mode.
The cursor change works 100% if you are playing in full screen at a monitors native resolution.
We are, however, encountering an issue when the user to change the resolution down from the native size. We maintain the native aspect ratio, but at smaller full-screen resolutions the cursor reverts to the native Windows cursor on the bottom and right hand sides of the screen. We were scratching our heads about this issue for a long while before I notice that this "boarder" where the mouse reverts seems to match the aspect ratio.
While I can not confirm this entirely, it appears that the cursor is reverting when it passes outside lower fullscreen resolution on the screen.
So, for example, please consider the following image.
The red area represents a native resolution of a 1920x1080 monitor. The game itself is running at 1600x900, a step below the full native resolution. Now, the blue area represents where the game's cursor renders correctly. However, when the mouse enters the red boarder, it reverts to the Window's default cursor.
Fun additional fact, the blue area in this example is 1600x900 of the monitors native 1920x1080.
So, yeah, has anyone else experienced this issue? If so, do you know a work around or a way to fix it? We are currently running in Unity 4.6.0.
I also have an open bug for this issue. Number 676731.
We are having the same issue and have no work around for it. Did you get any more info on the issue?
I'm also experiencing this issue. One ugly solution is to use cursor mode: force software. I find it slow and unresponsive, also it still displays the windows default cursor. I'm on unity 4.5
Sorry to bother you, but we're have the same issue. I was wondering if you've found a solution or heard back from Unity.
Answer by pavlito · Sep 07, 2015 at 10:58 AM
Try forcing directX 9 in your project. You can set it up via editor or create a shortcut to your .exe with the " force-d3d9 " without quotes.
Note, this can hang your game when you alt+tab to desktop, but should fix the aspect ratio issue. We have a similar problem where the buttons "collider" is offset when playing full-screen non-native resolution and we have to click a little bit to the left of the actual image representation of the button.
Adding "-force-d3d9" to the shortcut fixed the issue.
Hope it helps. Good luck!
Answer by AShenawy · Jul 28, 2020 at 08:07 AM
I know it's an old question, but I had the same issue recently while making a WebGL build. Because it's in browser, I don't believe the method @pavlito mentioned works for me.
After fiddling around, I finally found one solution. It had to do with the UI Canvas game object and its Canvas Scaler component. This is how it was originally set when I had the issue described by OP. It doesn't matter whether matching is by Width or Height.
Here's what I changed it to, to keep the custom cursor image at the right and bottom edges of the screen.
So, changing the Screen Match Mode property to Expand, instead of Match Width or Height, fixed the issue. But I don't know/understand why this is the cause in the first place.