Try setting up a button that can toggle mousemode on or off.
My guess is either the ready function happens at an bad time now. Or there is some other code after that ready function changing the capture mode. Or something happening to the OS.
func _unhandled_input(event: InputEvent):
if event is InputEventMouseButton:
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
elif event.is_action_pressed("ui_cancel"):
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
if Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED:
#just put your camera movement stuff here and you should be good to go
canvas layer by default have mouse interaction on, so it can prevent mouse capturing if you are using an unhandled input event to detect the mouse
I had learn this the hard way
sorry for the late reply