This is for a pause menu and I got a lot of unreasonable errors. I am also trying to get a foothold in Java scripting. These are the errors.
Assets/Scripts/PauseMenu.js(1,24): BCE0043: Unexpected token: :.
Assets/Scripts/PauseMenu.js(3,9): BCE0043: Unexpected token: public.
Assets/Scripts/PauseMenu.js(3,15): UCE0001: ';' expected. Insert a semicolon at the end.
Assets/Scripts/PauseMenu.js(3,23): UCE0001: ';' expected. Insert a semicolon at the end.
Assets/Scripts/PauseMenu.js(5,17): BCE0043: Unexpected token: Rect.
Assets/Scripts/PauseMenu.js(6,17): BCE0043: Unexpected token: boolean.
Assets/Scripts/PauseMenu.js(6,39): BCE0043: Unexpected token: ,.
Assets/Scripts/PauseMenu.js(6,40): UCE0001: ';' expected. Insert a semicolon at the end.
Assets/Scripts/PauseMenu.js(8,17): BCE0043: Unexpected token: void.
Assets/Scripts/PauseMenu.js(8,29): UCE0001: ';' expected. Insert a semicolon at the end.
Assets/Scripts/PauseMenu.js(10,28): BCE0044: expecting :, found '='.
This is the code I scripted. Thanks for the help.
public class pauseMenu : MonoBehavior;
{
public GUISkin myskin;
private Rect windowRect;
pricate bool paused = false, waited = true;
pricate 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)
paused = false;
else
paused = true;
waited = false;
Invoke("waiting",0.3f);
}
if(paused)
Time.timeScale =0;
else
Time.timeScale =1;
}
private void OnGUI()
{
if (paused)
windowRect = GUI.Window(0,windowRect,windowFunc, "Pause Menu");
}
private void windowFunc(int id)
{
if(GUILayout.Button("Resume"))
{
paused = false;
}
GUILayout.BeginHorizontal();
if(GUILayout.Button("Options"))
{}
if(GUILayer.Button("Main Menu"))
{}
GUILayout.EndHorizontal();
}
}
↧