x


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!

more ▼

asked Apr 27 '12 at 10:35 PM

BakuJake13 gravatar image

BakuJake13
30 12 19 23

(comments are locked)
10|3000 characters needed characters left

1 answer: sort newest

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)

more ▼

answered Apr 27 '12 at 11:15 PM

chris gough gravatar image

chris gough
97 5 7 9

if(Input.GetKey(KeyCode.P) || Input.GetKey(KeyCode.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;

Apr 29 '12 at 11:26 AM chris gough
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3892
x1002
x402
x268
x105

asked: Apr 27 '12 at 10:35 PM

Seen: 559 times

Last Updated: Apr 29 '12 at 11:26 AM