Hi guys i have a problem with my script.I get an error that my script take arguments.
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class MainMenu : MonoBehaviour {
public static MainMenu instance;
public string CurMenu;
public List<Buyable> Characters = new List<Buyable> ();
public Texture2D P;
public Texture2D S;
public Texture2D Set;
void Awake()
{
CurMenu = "Main";
instance = this;
}
// Use this for initialization
void ToMenu(string menu){
CurMenu = menu;
}
void OnGUI(){
if (CurMenu == "Play")
Play();
if (CurMenu == "Shop")
Shop();
if (CurMenu == "Settings")
Settings();
if (CurMenu == "Main")
Main();
}
private void Main()
{
if (GUI.Button (new Rect (100,150, 150, 100), P)) {
ToMenu ("Play");
}
if (GUI.Button (new Rect (100,250, 150, 20), "Play")) {
ToMenu ("Play");
}
if (GUI.Button (new Rect (400,150, 150, 100), S)) {
ToMenu ("Shop");
}
if (GUI.Button (new Rect (400,250, 150, 20), "Shop")) {
ToMenu ("Shop");
}
if (GUI.Button (new Rect (700,150, 150, 100), Set)) {
ToMenu ("Settings");
}
if (GUI.Button (new Rect (700,250, 150, 20), "Settings")) {
ToMenu ("Settings");
}
}
private void Menu()
{
if(GUI.Button(new Rect(0,375,128,32),"Back")){
ToMenu("Main");
}
}
private void Shop(Rect position, Buyable buyable)
{
if(GUI.Button(new Rect(0,375,128,32),"Back"))
{
ToMenu("Main");
}
{
GUIContent iconButtonLabel = new GUIContent(buyable.CharTexture, "Some Tooltip");
GUIContent textButtonLabel = new GUIContent(buyable.name, "Another Tooltip");
GUILayout.BeginArea(position);
if (GUILayout.Button(iconButtonLabel))
print ("you clicked the icon");
if (GUILayout.Button(textButtonLabel))
print ("you clicked the text button");
GUILayout.EndArea();
}
}
private void Settings()
{
if(GUI.Button(new Rect(0,375,128,32),"Back")){
ToMenu("Main");
}
}
private void Play()
{
if(GUI.Button(new Rect(0,375,128,32),"Back")){
ToMenu("Main");
}
}
}
[System.Serializable]
public class Buyable
{
public string name;
public Texture2D CharTexture;
public int Cost;
}
I know im supposed to be adding something on
if (CurMenu == "Shop")
Shop();
But i have no idea what,i tried adding lots of things on Shop(); but all errors.Thanks