Show mouse cursor only work on second click

I have a widget menu when I start the game and I want to hide the mouse when I click on Play. The problem is that the mouse hide itself only if I do a second click after I click on play, otherwise the mouse cursor is still here and I can’t move the camera player. Do you know why this happens?