Toggle hidden and visible cursor with standard asset FPS Controller

It should not be hard to do, But I try to show and hide the cursor depending if the game is pause or not.

So far all that happen is that the cursor is hidden, it appear when I Pause the game and after that the cursor happen until I click somewhen, and the cursor finaly hide himself. I really don’t undestand since this behaviour does not seem to be in the fps Controller script and I do not find the specific line. It is mostly annoying since I code to hide the cursor when it is not the right moment, here is part of the script

if (GetComponent ().isPause == true)
{
Cursor.visible=true;
Cursor.lockState = CursorLockMode.None;

}
if(GetComponent().isPause==false)
{
Cursor.visible=false;
m_MouseLook.UpdateCursorLock();
Cursor.lockState = CursorLockMode.Locked;
}

I suppose the problem is somewhere else since by default everytime I press escape the cursor appear even before I code anything so I guess it is Link to the FPS Controller but I checked the script and I can’t find the source of the behaviours

It may have something to do with the default Input binding “Cancel” to the escape key.

Have you tried to build the game and run it?