- Home /
Difficulty Pausing the MouseLook Script
I’m having difficulty freezing the MouseLook script in the FPS Controller. I have an options menu that appears when the player wins or loses. I want the FPS camera to stop while the menu is open. I have tried
GameObject.Find("FPSController").GetComponent<MouseLook>().enabled = false;
and similar statements. They all give the error “The name `MouseLook' does not exist in the current context.” I am new to Unity and a beginner in C#.
//win screen
if (gamevars.win == true) {
//code
GameObject.Find("FPSController").GetComponent<MouseLook>().enabled = false;
if (GUI.Button(new Rect(Screen.width / 2 - 100, Screen.height / 2 - 0, 100, 50), "Play Again")){
//code
}
}
Answer by BiG · Jul 17, 2015 at 12:55 PM
Probably, that script have no visibility of FirstPerson
class.
Try adding
using UnityStandardAssets.Characters.FirstPerson;
at the top of the script.
Thanks, that worked. I did have to change
.GetComponent<$$anonymous$$ouseLook>().enabled = false;
to
.GetComponent<FirstPersonController>().enabled = false;
because “UnityStandardAssets.Characters.FirstPerson.$$anonymous$$ouseLook' does not contain a definition for `enabled'.”
Your answer
Follow this Question
Related Questions
Collider With a FootStep sound. 0 Answers
how do i disable fps controler 0 Answers
fpscontrol how do i login on unity 1 Answer
Pushing First Person Controller 0 Answers
Combining first person contoller and dual touchpads from standard assets 0 Answers