I’m still learning and I can’t figure out how to get past this, I’m trying to create a menu system with OnGUI. I’ve tried getting rid of public making it just a void and it just gives me another error saying Unexpected symbol { It’s probably something very basic that i’m doing wrong. I’ve been looking around for GUI Menu tutorials and can’t seem to find one specifically for what i’m trying to create.
Error in Unity: Assets/Scripts/GUI/MainMenu.cs(18,30): error CS1525: Unexpected symbol `public’
Code:
using UnityEngine;
using System.Collections;
public class MainMenu : MonoBehaviour {
public bool mainMenuScreen;
public bool ventureScreen;
public bool craftingScreen;
public bool followersScreen;
public bool inventoryScreen;
public bool equipmentScreen;
public bool contactsScreen;
void Start(){
if(mainMenuScreen = true){
public void OnGUI(){ //!!!!!THIS IS THE LINE WHERE THE ERROR IS!!!!!
if (GUI.Button (new Rect ((Screen.width / 2) - 100, 220, 220, 30), "Venture Out/Travel")) {
}
if (GUI.Button (new Rect ((Screen.width / 2) - 100, 260, 200, 30), "Crafting")) {
}
if (GUI.Button (new Rect ((Screen.width / 2) - 100, 300, 200, 30), "Followers")) {
}
if (GUI.Button (new Rect ((Screen.width / 2) - 100, 340, 200, 30), "Inventory")) {
}
if (GUI.Button (new Rect ((Screen.width / 2) - 100, 380, 200, 30), "Equipment")) {
}
if (GUI.Button (new Rect ((Screen.width / 2) - 100, 420, 200, 30), "Contacts")) {
}
}
}
if(ventureScreen = true){
//ventureScreen Menu
}
if(craftingScreen = true){
//craftingScreen Menu
}
if(followersScreen = true){
//followersScreen Menu
}
if(inventoryScreen = true){
//inventoryScreen Menu
}
if(equipmentScreen = true){
//equipmentScreen Menu
}
if(contactsScreen = true){
//contactsScreen Menu
}
}
}