How can i change variables in FirstPersonController scripts?

Hi.
I creating pause menu in my game.
When player click on whatever button in menu, cursor become hide.
I have idea, how can i block cursor hide, but variables not changed.
I use to help this site : How can I access FirstPersonController script variables? - Questions & Answers - Unity Discussions

In my code have this:
link to file:

public UnityStandardAssets.Characters.FirstPerson.MouseLook controller;

And changing variable when player press esc

controller.menuLocker = true;

Then in player controller i declared variable type bool and set it default as false.
Like here:

public bool menuLocker = false;

My problem is, when i press esc and menu show me, variable is not switched.
What i do wrong? Where i have problem?
Thanks to all, who help me.

Interesting, does that even get compiled? First of all controller is of MouseLook type so if you declared the menuLocker inside the FirstPersonController(gonna call it FPSc from now on) controller.menuLocker = true; should through a compiler error. Any way to get a reference(link) to the active instance of the FPSc you need to do something like this :

using UnityStandardAssets.Characters.FirstPerson;    //this is to avoid long names
public class MyClass : MonoBehaviour {
//...

public FirstPersonController controller;  
private MouseLook mLook;        //this is if you need a reference to the MouseLook instance the FPSc is using

void Awake(){
       mLook = controller.m_MouseLook;       //this sets the reference
}
void Start(){
       controller.menuLocker = true;        //this will access the menuLocker field in the active FPSc
}}

of course you need to put it on an GameObject inside the scene and then drag and drop the GameObject that contains the FPSc on the field controller. Also you need to go to the FPSc script find the m_MouseLook field and change it to public.

Note: the easiest way to stop this Cursor behaviour is to just disable the FPSc component you have active in scene while you are on menu and re enable it afterwards.

Note2: keep in mind that Unity in edit mode( inside editor) have a safenet that causes the cursor to get unlocked with esc regardless of your scripts, which might cause some funky behaviours some times. Doesn’t happen on builds.

Note3: watch out for the UpdateCursorLock() inside MouseLook class because it is the culprit that relocks the cursor on click and it is called internally inside LateUpdate on MouseLook and somewhere inside the FPSc script, quite annoying approach if you ask me.

I set reference to MouseLook manually, and yes, the Mouse Look is inside prefab first player controller.
public UnityStandardAssets.Characters.FirstPerson.MouseLook controller; // reference to file

public void GameMenuBackGame(){ //if player click on the button
		gameMenu.enabled = false;
		controller.ChangeMenuLocker (true);
	}

	// Update is called once per frame
	void Update () {
		if (Input.GetKeyDown(KeyCode.Escape)) {
			if (gameMenu.enabled == false) {
				gameMenu.enabled = true;
				controller.ChangeMenuLocker (false);
			}
		}
	}

This is all code, where i trying manipuled with variable.
Thanks