FPSController MouseLook

I have this script that I know use to work but now it’s not working with Unity 5 and I think I know the problem just don’t know how to fix it exactly. The script is disabling the FPS MouseLook when MouseButtonDown which pops up a GUI menu.

I now get a CS0246 error “The type namespace name ‘MouseLook’ could not be found.”

I think it has something to do with the old FPSController had a MouseLook script applied, but the one I’m using in Unity 5 has the MouseLook script as part of the FPS script.

Is there a way to modify the “GetComponent” to make this work?

using UnityEngine;
using System.Collections;

public class pauseMenu : MonoBehaviour {

	bool paused = false;

	void Start () 
	{
		GameObject.Find ("First Person Controller").GetComponent<MouseLook> ().enabled = true;
		Screen.lockCursor = true;
		Time.timeScale = 1;
	}	

	void Update () 
	{
		if (Input.GetMouseButtonDown (2))
			paused = togglePause ();
	}
	bool togglePause()
	{
		if (Time.timeScale == 0) 
		{
			GameObject.Find ("First Person Controller").GetComponent<MouseLook> ().enabled = true;
			Screen.lockCursor = true;
			Time.timeScale = 1;
			return(false);
		
		} else {

			GameObject.Find ("First Person Controller").GetComponent<MouseLook> ().enabled = false;
			Screen.lockCursor = false;
			Time.timeScale = 0;
			return(true);
		}
	}
}

I actually figured out a way around this by modifying the MouseLook.cs script (in Standard Assets, FirstPersonCharacter, Scripts folder) with “IF Statements” to “0” out the X&Y Sensitivity float value ButtonDown. Here’s the modified script.

using System;
using UnityEngine;
using UnityStandardAssets.CrossPlatformInput;

namespace UnityStandardAssets.Characters.FirstPerson
{
    [Serializable]
    public class MouseLook
    {
        public float XSensitivity = 2f;
        public float YSensitivity = 2f;
        public bool clampVerticalRotation = true;
        public float MinimumX = -90F;
        public float MaximumX = 90F;
        public bool smooth;
        public float smoothTime = 5f;


        private Quaternion m_CharacterTargetRot;
        private Quaternion m_CameraTargetRot;
			
        public void Init(Transform character, Transform camera)
        {
            m_CharacterTargetRot = character.localRotation;
            m_CameraTargetRot = camera.localRotation;
        }


        public void LookRotation(Transform character, Transform camera)
        {
						 
			float yRot = CrossPlatformInputManager.GetAxis ("Mouse X") * XSensitivity;
			float xRot = CrossPlatformInputManager.GetAxis ("Mouse Y") * YSensitivity;

			m_CharacterTargetRot *= Quaternion.Euler (0f, yRot, 0f);
			m_CameraTargetRot *= Quaternion.Euler (-xRot, 0f, 0f);

			if (Input.GetMouseButtonDown (2))
				Debug.Log (YSensitivity = 0f);

			if (Input.GetMouseButtonDown (2))
				Debug.Log (XSensitivity = 0f);

			if (Input.GetMouseButtonDown (1))
				Debug.Log (YSensitivity = 2f);
			
			if (Input.GetMouseButtonDown (1))
				Debug.Log (XSensitivity = 2f);
							
		if (clampVerticalRotation)
			m_CameraTargetRot = ClampRotationAroundXAxis (m_CameraTargetRot);

            if(smooth)
            {
                character.localRotation = Quaternion.Slerp (character.localRotation, m_CharacterTargetRot,
                    smoothTime * Time.deltaTime);
                camera.localRotation = Quaternion.Slerp (camera.localRotation, m_CameraTargetRot,
                    smoothTime * Time.deltaTime);
            }
            else
            {
                character.localRotation = m_CharacterTargetRot;
                camera.localRotation = m_CameraTargetRot;
            }
        }


        Quaternion ClampRotationAroundXAxis(Quaternion q)
        {
            q.x /= q.w;
            q.y /= q.w;
            q.z /= q.w;
            q.w = 1.0f;

            float angleX = 2.0f * Mathf.Rad2Deg * Mathf.Atan (q.x);

            angleX = Mathf.Clamp (angleX, MinimumX, MaximumX);

            q.x = Mathf.Tan (0.5f * Mathf.Deg2Rad * angleX);

            return q;
        }
	}
}

using UnityEngine;
using System.Collections;
using UnityStandardAssets.Characters.FirstPerson;

public class pauseMenu : MonoBehaviour {

 bool paused = false;

 void Start () 
 {
     GameObject.Find ("First Person Controller").GetComponent<UnityStandardAssets.Characters.FirstPerson.MouseLook> ().enabled = true;
     Screen.lockCursor = true;
     Time.timeScale = 1;
 }