Not sure how to fix this. Please help.
using UnityEngine;
using System.Collections;
public class MainMenu : MonoBehaviour {
private string Omuni = "Omuni Online";
private int buttonWidth = 200;
private int buttonHeight = 50;
void OnGUI()
{
GUI.Label (new Rect(10, 10, 200, 200), Omuni) ;
if (GUI.Button (new Rect(Screen.width / 2 - buttonWidth / 2, 200,buttonWidth, buttonHeight), "Play Omuni Online"))
(
Application.Loadlevel(1);
)
}
}
Assets/MainMenu.cs(14,38):error CS1002: Expecting ';'
Assets/MainMenu.cs(15,17):error CS1002: Expecting ';'
You forgot to put a semicolon ( ; ) in the end on the line (GUI.Label).
There is a semi colon on the end of that line.
I included the error reports which also includes the lines that have errors in them.
Please continue throwing out solutions.
change
(
Application.Loadlevel(1);
)
to
{
Application.Loadlevel(1);
}
Sorry but I am having another error.
using UnityEngine;
using System.Collections;
public class MainMenu : MonoBehaviour {
private string Omuni = "Omuni Online";
private int buttonWidth = 200;
private int buttonHeight = 50;
void OnGUI()
{
GUI.Label (new Rect(10, 10, 200, 200), Omuni);
if (GUI.Button (new Rect(Screen.width / 2 - buttonWidth / 2, 200,buttonWidth, buttonHeight), "Play Omuni Online"))
{
Application.Loadlevel(1);
}
Assets/MainMenu.cs(15,17): error CS1002: Expecting ';'
using UnityEngine;
using System.Collections;
public class MainMenu : MonoBehaviour {
private string Omuni = "Omuni Online";
private int buttonWidth = 200;
private int buttonHeight = 50;
void OnGUI()
{
GUI.Label (new Rect(10, 10, 200, 200), Omuni) ;
if (GUI.Button (new Rect(Screen.width / 2 - buttonWidth / 2, 200,buttonWidth, buttonHeight), "Play Omuni Online"))
{
Application.Loadlevel(1);
}
}
Still not fixed.
Assets/MainMenu.cs(17,0): error CS8025: Parsing error
Final Product
Added a }
Added a capital L to LoadLevel
using UnityEngine;
using System.Collections;
public class MainMenu : MonoBehaviour {
private string Omuni = "Omuni Online";
private int buttonWidth = 200;
private int buttonHeight = 50;
void OnGUI()
{
GUI.Label (new Rect(10, 10, 200, 200), Omuni) ;
if (GUI.Button (new Rect(Screen.width / 2 - buttonWidth / 2, 200,buttonWidth, buttonHeight), "Play Omuni Online"))
{
Application.LoadLevel(0);
}
}
}
now it works for me
using UnityEngine;
using System.Collections;
//public class MainMenu : MonoBehaviour {
public class NewBehaviourScript : MonoBehaviour
{
private string Omuni = "Omuni Online";
private int buttonWidth = 200;
private int buttonHeight = 50;
void OnGUI()
{
GUI.Label(new Rect(10, 10, 200, 200), Omuni);
if (GUI.Button(new Rect(Screen.width / 2 - buttonWidth / 2, 200, buttonWidth, buttonHeight), "Play Omuni Online"))
{
// Application.Loadlevel(1);
}
}
// Use this for initialization
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
since im using javascript i got abit confused sry for that^^