How to synchronize pause and inventory scripts

I made a pause script that locks the camera and character controls. I’ve also begun working on an inventory script. I want the player to be able to use the mouse when the inventory is open so i did the same thing as the pause script. However, this only works once, if pause or inventory is opened more than once, the camera doesn’t lock any more. How can I fix this or, would it be wiser to make the inventory part of the pause screen? How would I go about doing that?

Inventory

void Update(){
		if(Input.GetButtonDown("Inventory")){
			if(showInventory){
				Time.timeScale = 1; //DO NOT CHANGE VALUE
				player.GetComponent<MouseLook>().enabled = true;
				player.GetComponent<CharacterController>().enabled = true;
				mainCamera.GetComponent<MouseLook>().enabled = true;
				showInventory = false;
			}
			else if(!showInventory){
				Time.timeScale = 0; //DO NOT CHANGE VALUE
				player.GetComponent<MouseLook>().enabled = false;
				player.GetComponent<CharacterController>().enabled = false;
				mainCamera.GetComponent<MouseLook>().enabled = false;
				showInventory = true;
			}
		}
	}

Pause

public class Pause : MonoBehaviour {
	public static bool gamePaused = false;

	public GameObject player;
	public GameObject mainCamera;

	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
		GamePause();	
	}

	void OnGUI(){
		if(gamePaused){
			GUI.Box(new Rect((Screen.width / 2), (Screen.height /2), 100, 50), "Pause");
		}
	}

	public void GamePause(){
		if(Input.GetButtonDown("Pause")){
			if(gamePaused){
				Time.timeScale = 1; //DO NOT CHANGE VALUE
				player.GetComponent<MouseLook>().enabled = true;
				player.GetComponent<CharacterController>().enabled = true;
				mainCamera.GetComponent<MouseLook>().enabled = true;
				gamePaused = false;
			}
			else if(!gamePaused){
				Time.timeScale = 0; //DO NOT CHANGE VALUE
				player.GetComponent<MouseLook>().enabled = false;
				player.GetComponent<CharacterController>().enabled = false;
				mainCamera.GetComponent<MouseLook>().enabled = false;
				gamePaused = true;
			}
		}
	}

}

Is the pause linked to the escape button?
cause that automatically shows your cursor in the unity editor.
try building the game and see if you still have that issue.

This might not be the most efficient way. but, it works.

public void GamePause(){
		if(Input.GetButtonDown("Pause")){
			if(gamePaused){
				Time.timeScale = 1; //DO NOT CHANGE VALUE
				player.GetComponent<MouseLook>().enabled = true;
				player.GetComponent<CharacterController>().enabled = true;
				mainCamera.GetComponent<MouseLook>().enabled = true;
				gamePaused = false;
			}
			else{
				Time.timeScale = 0; //DO NOT CHANGE VALUE
				player.GetComponent<MouseLook>().enabled = false;
				player.GetComponent<CharacterController>().enabled = false;
				mainCamera.GetComponent<MouseLook>().enabled = false;
				gamePaused = true;
			}

			if(!gamePaused && Inventory.showInventory){
				Time.timeScale = 0; //DO NOT CHANGE VALUE
				player.GetComponent<MouseLook>().enabled = false;
				player.GetComponent<CharacterController>().enabled = false;
				mainCamera.GetComponent<MouseLook>().enabled = false;
			}
		}
	}