Mouse input mode stuck on "captured" after stopping scene in editor

Godot Version

4.7.1

Question

I’m working on a very simple project, and somehow I’ve come to a state where my mouse cursor is hidden when I start the scene in the editor. I only have two scenes (a start menu and the “game”), the second of which does use MOUSE_MODE_CAPTURED which works as expected, but the first scene (which is just a few Control nodes) seems to also be following that even when setting the mouse mode to MOUSE_MODE_VISIBLE in a _ready function.

I really have no idea where to look for what could be hiding the cursor here. Here is the commit on Codeberg where I’ve introduced the main_menu scene that’s giving me issues. ball.gd captures the mouse, but that script is not present in the main_menu scene where I’m unable to see the cursor. Any ideas on where to start? Am I missing some project level setting?

Further details (edited 7/27/26)

I’ve found that things work as expected (no cursor on the main menu, and a captured cursor in the game scene) after restarting Godot, or launching the game using the “Run Project” button from the Projects menu on startup. It looks like the problem happens after running the project from the editor, and then stopping from the editor while in the scene that changes the input mode to MOUSE_MODE_CAPTURED. After that, starting the project finds the mouse invisible (the same observable behavior as if it were captured). Using set_mouse_mode instead of assinging to mouse_mode doesn’t change anything.

I don’t see anything wrong in the code you uploaded. Try commenting out the MOUSE_MODE_CAPTURED line and see if that changes anything.

No luck commenting out either or both of the mouse_mode assignments. :confused:

Maybe this will help.

It’s mouse capture on demand so that you can still move mouse outside game window for debugging or even stopping.

Create an empty scene with just Node and rename it to MouseLock. Then add this scene to your project or Globals Autoload and run. Pressing ESC changes Input.mouse_mode

extends Node

var paused := false
## an event that is called when paused state is set- passes a bool with the new state
signal paused_changed

# Called when the node enters the scene tree for the first time.
func _ready():
	#set paused on startup
	set_paused(false)

func set_paused(_paused : bool) -> void:
	paused = _paused
	Input.mouse_mode = Input.MOUSE_MODE_VISIBLE if _paused else Input.MOUSE_MODE_CAPTURED
	paused_changed.emit(paused)


func _input(event: InputEvent) -> void:
	if event is InputEventKey:
		if event.is_action_pressed("ui_cancel"):
			paused = !paused
			set_paused(paused)