Losing Mouse Cursor when Switching Scenes

Godot Version

Replace this line with your Godot version

Question

Can't control Mouse when Switching to Next Scene, is it a pause issue or character control issue?

In the main level scene you have to click to start controlling the character, I was wondering if that could be causing the problem? Or is it something else with how the “Win” scene is loaded?

func _input(event):
	#Misc. Controls ---------------------------------------------
	#Input = "Left Click" to Capture Mouse Movement i.e. Control the camera.
	if event.is_action_pressed("left_click"):
		Input.mouse_mode = Input.MOUSE_MODE_CAPTURED

“Win” Scene, all the green-ish buttons aren’t clickable, and I can’t use my mouse, have to alt + tab to close out of the game :

Script for how the Win conditions are met :

#Viewer Count
func _add_viewers(new_viewer_count: int) -> void:
	_viewer_count = new_viewer_count
	_viewer_count_label.text = "Viewers: " + str(_viewer_count)
	
	if new_viewer_count >100: 
		$"../WinTimer".start()
		move_speed = 0 
		$Musik.stop()
		$"../Party".play()
		mouse_sensitivity = 0.0
		$"../ColorRect/AnimationPlayer".play("fade_IN")


func _on_win_timer_timeout():
	_Win()

func _Win():
	get_tree().paused = false
	get_tree().change_scene_to_file("res://Win/win.tscn")

^ I tried adding the “get_tree().paused” line in my Win function, to see if it would help any but I’m not sure if I did that right… :sweat_smile:

You have to enable the mouse cursor again.

For example in your Win Function (before you change scene probably) or in a script in your win scene.
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE

1 Like

Ah, perfect thank you so much!! :grinning:
Just for reference just had to add that line to my Win function like this :

func _Win():
	get_tree().paused = false
	Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
	get_tree().change_scene_to_file("res://Win/win.tscn")
1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.