I wrote the game and came across this error:
Assets/Scripts/pauseMenu.cs(40,6): error CS0111: A member `Pausemenu.Update()’ is already defined. Rename this member or use different parameter types
Here is the code of this file:
using UnityEngine;
using System.Collections;
public class Pausemenu : MonoBehaviour {
private int buttonWith = 200;
private int buttonHeight = 50;
private int grouoWidth = 200;
private int groupHeight = 170;
bool paused;
void Start ()
{
GameObject.Find("First Person Controller").GetComponent().enabled = true;
Time.timeScale = 1;
}
void Update ()
{
if(paused)
{
GUI.BeginGroup(new Rect(((Screen.groupWidth/2) - (groupWidth/2)),((Screen.groupHeight/2)),groupWidth, groupHeight));
if(GUI.Button(new Rect(0,0,buttonWidth,buttonHeight),"Main Menu"));
{
Application.LoadLevel(0);
}
if(GUI.Button(new Rect(0,60,buttonWidth,buttonHeight,"Restart Game")));
{
Application.LoadLevel(1);
}
if(GUI.Button(new Rect(0,120,buttonWidth,buttonHeight),"Quit Game"));
{
Application.Quit();
}
GUI.EndGroup();
}
}
void Update ()
{
if(Input.GetKeyUp(KeyCode.Escape))
paused = togglePause();
}
bool togglePause()
{
if(Time.timeScale == 0)
{
GameObject.Find("Player").GetComponent().enabled = true;
Screen.lockCrusor = true;
Time.timeScale = 1;
return(false);
}
else
{
GameObject.Find("Player").GetComponent().enabled = false;
Screen.lockCrusor = false;
Time.timeScale = 0;
return(true);
}
}
}