- Home /
Mouse Orbit Pause Menu problem
hey guys. i made a pause menu script and i have my character model set on mouse orbit but it doesnt work with the pause script. here's the pause menu script:
using UnityEngine;
using System.Collections;
public class PauseMenu : MonoBehaviour { public GUISkin myskin;
private Rect windowRect;
private bool paused = false , waited = true;
private void Start()
{
windowRect = new Rect(Screen.width / 2 - 100 , Screen.height / 2 - 100, 200, 200);
}
private void waiting()
{
waited = true;
}
private void Update ()
{
if (waited)
if(Input.GetKey(KeyCode.P) || Input.GetKey(KeyCode.Escape))
{
if (paused)
paused = false;
else
paused = true;
waited = false;
Invoke("waiting",0.3f);
}
}
private void OnGUI()
{
if (paused)
windowRect = GUI.Window(0,windowRect, windowFunc, "Pause Menu");
}
private void windowFunc(int id)
{
if(GUILayout.Button("Resume"))
{
paused = false;
}
if(GUILayout.Button("Options"))
{
}
if(GUILayout.Button("Return to Main Menu"))
{
Application.LoadLevel ("Main Menu");
}
}
}
Do you think you could send me some advice on how to make the orbit pause along with the menu? Thanks!
Answer by chris gough · Apr 27, 2012 at 11:15 PM
GameObject.Find("First Person Controller").GetComponent(mouse Orbit).enabled = false;
The names may not be correct but this is kind of the basic of what you need to use. Also yo unpause just change the false to true.
(just realised your code is c# so may not work, but someone might be able to translate it for you)
if(Input.Get$$anonymous$$ey($$anonymous$$eyCode.P) || Input.Get$$anonymous$$ey($$anonymous$$eyCode.Escape)) { if (paused) paused = false; GameObject.Find("First Person Controller").GetComponent(mouse Orbit).enabled = true; else paused = true; GameObject.Find("First Person Controller").GetComponent(mouse Orbit).enabled = false;
Your answer
Follow this Question
Related Questions
pause game 2 Answers
Script that makes the mouse cursor invisible. 3 Answers
Pause menu script, mouse not hiding 1 Answer
A node in a childnode? 1 Answer
Can you pause unity playmode while mouse button is down? 2 Answers