- Home /
Mouse Look and Character Motor off but i can still see :( help plox?
hey guys :)
iv turned the Mouse Look and Character Motor scripts off, but i can still look up and down.
iv cut out the unimportant stuff but heres what im using:
var IsPaused : boolean = false;
function Start() { Screen.showCursor = false; };
function Update() {
if (Input.GetKeyDown ("escape")){
if (IsPaused == true){
IsPaused = false;
Time.timeScale = 1.0;
Screen.showCursor = false;
}
else{
IsPaused = true;
Time.timeScale = 0.00001;
Screen.showCursor = true;
};
};
};
function OnGUI() { if (IsPaused == true){
var ResumeButton : boolean = GUI.Button(Rect(Screen.width/2, Screen.height/2, 175, 20), "Resume Game");
var VisitWebsite : boolean = GUI.Button(Rect(Screen.width/2, Screen.height/2 + 25, 175, 20), "Visit the Website");
var QuitButton : boolean = GUI.Button(Rect(Screen.width/2, Screen.height/2 + 25 + 25, 175, 20), "Exit");
GameObject.Find('Player').GetComponent('MouseLook').enabled = false;
GameObject.Find('Player').GetComponent('CharacterMotor').enabled = false;
if (QuitButton){
Application.Quit();
};
if (ResumeButton){
IsPaused = false;
Time.timeScale = 1.0;
Screen.showCursor = false;
};
if (VisitWebsite){
Application.OpenURL("www.google.com");
};
}
else{
GameObject.Find('Player').GetComponent('MouseLook').enabled = true;
GameObject.Find('Player').GetComponent('CharacterMotor').enabled = true;
return;
};
};
also the timescale does absolutly shit all (excuse the language) but every time i ask how to make a pause menu people always say to use timescale and it does absolutly nothing for me.
but this is pretty much a work around and i know it works.
the character cant move at all and you cant look around, the game still goes on so it isnt pausing really..its more for my interactives.
thing is, you can still look up and down and i dont know why. i tried unticking every script and it still does it.
help please :S?
Answer by Velketor · Mar 23, 2011 at 02:53 PM
make sure you are unchecking the scripts on the Character Controller, not just the scripts on the camera.
Answer by Gambit · Mar 24, 2011 at 02:01 AM
iv turned the Mouse Look and Character Motor scripts off
sorry it wouldnt let me login :L
Answer by haxard · Apr 06, 2012 at 09:35 PM
The Mouse Look script is on two objects: the First Person Controller, and the Main Camera that is a child of the Controller.
You're only disabling the one on the First Person Controller, which handles the X axis (MouseX). That's why you can still look up and down.
You also need to disable the Mouse Look script on the Main Camera, which handles the Y axis (MouseY).
Hope that helped
Answer by doomlazy · Jun 26, 2014 at 09:31 PM
Thank you haxard.
I made 2 scripts. One is called "PauseMenu.js" The other is called "PauseMenu2.js"
I have PauseMenu on my FirstPersonController and PauseMenu2 on my camera.
PauseMenu:
var paused : boolean = false;
var backgroundMusic : AudioSource;
function Update ()
{
if(Input.GetKeyDown(KeyCode.Escape) && paused == false)
{
GetComponent(MouseLook).enabled = false;
paused = true;
backgroundMusic.mute = true;
Time.timeScale = 0;
}
else if(Input.GetKeyDown(KeyCode.Escape) && paused == true)
{
GetComponent(MouseLook).enabled = true;
paused = false;
backgroundMusic.mute = false;
Time.timeScale = 1;
}
}
PauseMenu2:
var paused : boolean = false;
function Update ()
{
if(Input.GetKeyDown(KeyCode.Escape) && paused == false)
{
GetComponent(MouseLook).enabled = false;
paused = true;
Time.timeScale = 0;
}
else if(Input.GetKeyDown(KeyCode.Escape) && paused == true)
{
GetComponent(MouseLook).enabled = true;
paused = false;
Time.timeScale = 1;
}
}
Hope This Helps!
Your answer
Follow this Question
Related Questions
Locking cursor/mouse on an object 1 Answer
Locking the Cursor at the center. 4 Answers
Mouse lock to target 0 Answers
menu issue and mouse click 0 Answers
Cant unlock cursor with FPS prefab 2 Answers