Cursor on canvas only?

my game uses the mouse to rotate/ fire etc so when lose all lives the game over canvas is enabled ontop of the game screen, i have a inputfield nd button to enter the score, but the mouse still activates on the screen under the canvas, is there a way to only have the mouse active on the canvas so i dont have to make more scripts to deactivate the mouse from the game aswell as i cant find a way to do this?

I’m not sure why your mouse is under the canvas that is interesting. I personally use Cursor.lockState = CursorLockMode.Locked; while the game is active and any time the player loads a menu or when the player dies and the game over screen pops up I use Cursor.lockState = CursorLockMode.None;. This works across the board for me and I just use this one line to control the cursor in any script that needs it.