Mouse position is offset in the debugger

Godot Version

4.5.1

Question

When running the debugger, the mouse position the game registers is consistently offset from the actual position of the mouse. The problem only occurs when both ‘Embed Game on Next Play’ and Make Game Workspace Floating on Next Play’ are checked. The actual code shouldn’t be at fault as even the Sprite2D running the script included below is offset from the mouse.


Here’s the position not working ( ‘Embed Game on Next Play’ and Make Game Workspace Floating on Next Play’ are checked)


Here’s the position working (Only ‘Embed Game on Next Play’ is checked)

Can you try this instead and see if it works?

global_position = get_global_mouse_position()

Nope, everything is exactly the same. Besides, every single object acts as though the mouse’s position is at the position indicated by the Sprite2D, so the problem isn’t in the code of the Sprite2D.

I can’t recreate your issue, whatever I try the mouse position is centered on the sprite.

Can you try recreating that in a new empty project to see if you will have the same behavior?

I created a new project and the issue persisted, but only if the window size was set to 1920 x 1080 in the project settings.

Sorry, I can’t recreate the issue and I don’t see why it would happen.
Maybe try a newer or older version of the engine to see if this persists.
If that doesn’t help, you can try reporting an official bug on GitHub.

Thanks anyways.

1 Like