how to lock screen?

Hi guys, currently i have a NPC, and when you pressed the button ‘e’, it will pop out a question box and you can click to select the correct answer, but when you move your mouse, your camera will move too right? and my previous partner made a script which only contains this (see below) and it only stops the camera from moving left and right but not up and down.

when the button ‘e’ is pressed, the “LOCKDOWNScr = true” is called but it only locks left and right, but not up and down. i don’t get it, the script is empty but it works only for left and right?

need some help please ~ thanks !

using UnityEngine;
using System.Collections;

public class LockingDown : MonoBehaviour 
	public bool LOCKDOWNScr = false;
	// Use this for initialization
	void Start () 
	// Update is called once per frame
	void Update () 

I would guess you are using the Character Controller and the mouse control that goes with it.
If not, the same process will apply anyway.

Simply deactivate the mouse control script while the gui is on and reactivate it when you have made your choice. Using the CC, you have to get two MouseLook

bool guiOn = false;
MouseLook scriptPlayer;
MouseLook scriptCam;

void Start(){
    // If the GUI script is not on the character then you need first to find the object
    scriptPlayer = GetComponent<MouseLook>();
    scriptCam = scriptCam.GetComponent<MouseLook>();

void OnGui(){
        scriptPlayer.enabled = false;
        scriptCam.enabled = false;
    if(choice is made){
        scriptPlayer.enabled = true;
        scriptCam.enabled = true;