i have this code:
#pragma strict
var customskin:GUISkin;
var opzioni:Texture2D;
var banner:Texture2D;
var difficulty:String;
//these variables are used for better graphics making,
//simply ignore them if they aren't used
var val1:float = 10;
var val2:float = 10;
var val3:float = 10;
var val4:float = 10;
function Start() {
PlayerPrefs.SetString("difficulty","easy");
difficulty=PlayerPrefs.GetString("difficulty");
}
function OnGUI () {
GUI.DrawTexture(Rect(150,55,580,130), banner);
if (GUI.Button(Rect(300,200,219,58), opzioni, "buttonoptions")){
Application.LoadLevel("menu"); }
if (GUI.Button(Rect(630,290,130,50), difficulty)){
if (difficulty=="easy"){
difficulty="hard";
PlayerPrefs.SetString("difficulty", difficulty); }
else if (difficulty=="hard") {
difficulty="fearless";
PlayerPrefs.SetString("difficulty", difficulty); }
else (difficulty=="fearless");
difficulty="easy";
PlayerPrefs.SetString("difficulty", difficulty); }
}
But it won’t work! the GUI.Button remain “easy”.
How can i fix it?