So in my pause menu I have found out how to lock everything I can exept for the cameras Y-axis movement. I’ve looked up all kinds of stuff and cant figure it out. Anyone know what I should do?
Thanks
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.Escape) || Input.GetKey(KeyCode.P)){
if(paused == true)
paused = false;
else
paused = true;
waited = false;
Invoke("waiting",0.3f);
}
if (paused == true) {
//makes cursor appear when in the menu
Cursor.visible = true;
//disables player movement
gameObject.GetComponent<PlayerMovement>().enabled = false;
//camera cannot look horizontally
gameObject.GetComponent<MouseLook>().enabled = false;
//disables shooting
gameObject.GetComponent<PlayerShooting>().enabled = false;
}
else {
//Cursor is not visible when not in the menu
Cursor.visible = false;
//Player can move when menu is not up
gameObject.GetComponent<PlayerMovement>().enabled = true;
//Camera can look horizontally when menu not up
gameObject.GetComponent<MouseLook>().enabled = true;
//Shooting when not in menu
gameObject.GetComponent<PlayerShooting>().enabled = true;
}
}
private void OnGUI(){
if (paused)
windowRect = GUI.Window(0, windowRect, windowFunc, "Pause Menu");
}
private void windowFunc(int id){
//Exits Pause
if(GUILayout.Button("Resume")){
paused = false;
}
//Options for game
if(GUILayout.Button("Options")){
//Audio and Video Settings
}
//Quits the game
if(GUILayout.Button("Exit Game")){
Application.Quit();
}
}
}