- Home /
Why is my character unlock screen button re-enabling after unlocking a different character?
I have a character unlock screen, which when you completed one playthrough session you can unlock one character. This will replace the unlock button with a label to say that the character has been unlocked. My issue is when you have completed a second playthrough & the character unlock screen appears. When you press to unlock the second character it resets the unlock button for the first character so you can unlock it again (which I don't want it to do that, when it's unlocked it should stay unlocked not reappearing with the unlock button again.) I've changed the code so many times now & it still comes up with the same bug.
The help would be much appreciated. Thanks
GUI.DrawTexture (new Rect (60, 0, 180, 220), DOCTOR_FEMALE);
if (UNLOCKED_DOCTOR_FEMALE == 0) {
TEXT_object.GetComponent(Score_Currency).UPDATEscore();
//SAVED_money = PlayerPrefs.GetInt("SavedMoney");
if (GUI.Button (new Rect (0, 270, 300, 30), "Unlock Doctor Female")) {
//if(SAVED_money > DoctorF_amount_to_buy) {
UNLOCKED_DOCTOR_FEMALE = 1;
SAVED_money = SAVED_money - DoctorF_amount_to_buy;
TEXT_object.GetComponent(Score_Currency).UPDATEscore2(SAVED_money);
Debug.Log("BOUGHT FEMALE DOCTOR CHARACTER!!!");
InfoToSave.SAVED_money = SAVED_money;
InfoToSave.UNLOCKED_DOCTOR_FEMALE = UNLOCKED_DOCTOR_FEMALE;
SaveGameData();
Application.OpenURL(TWITTER_ADDRESS + "?text=" + WWW.EscapeURL(TEXT_to_DISPLAY_doctorF) + "&lang=" + WWW.EscapeURL(TWEET_LANGUAGE));
Application.OpenURL(FACEBOOK_ADDRESS);
Debug.Log(UNLOCKED_PARAMEDIC_MALE);
Debug.Log(UNLOCKED_DOCTOR_FEMALE);
//Debug.Log(SAVED_money);
//}
}
}
if (savedINFO.UNLOCKED_DOCTOR_FEMALE == 1) {
UNLOCKED_DOCTOR_FEMALE = 1;
GUI.Label (new Rect (60, 270, 300, 30), "Unlocked Doctor!", myLABLEstyle);
}
//GUI.skin.box = style3;
//GUILayout.Button("This is a button.");
GUI.DrawTexture (new Rect (380, 0, 180, 220), PARAMEDIC_MALE);
if (UNLOCKED_PARAMEDIC_MALE == 0) {
TEXT_object.GetComponent(Score_Currency).UPDATEscore();
if (GUI.Button(new Rect(320, 270, 300, 30), "Unlock Paramedic Male")) {
//if(SAVED_money > ParamedicM_amount_to_buy) {
UNLOCKED_PARAMEDIC_MALE = 1;
SAVED_money = SAVED_money - ParamedicM_amount_to_buy;
TEXT_object.GetComponent(Score_Currency).UPDATEscore2(SAVED_money);
Debug.Log("BOUGHT PARAMEDIC MALE CHARACTER!!!");
InfoToSave.SAVED_money = SAVED_money;
InfoToSave.UNLOCKED_PARAMEDIC_MALE = UNLOCKED_PARAMEDIC_MALE;
SaveGameData();
Application.OpenURL(TWITTER_ADDRESS + "?text=" + WWW.EscapeURL(TEXT_to_DISPLAY_paramedicM) + "&lang=" + WWW.EscapeURL(TWEET_LANGUAGE));
Application.OpenURL(FACEBOOK_ADDRESS);
Debug.Log(UNLOCKED_DOCTOR_FEMALE);
Debug.Log(UNLOCKED_PARAMEDIC_MALE);
//}
}
}
if (savedINFO.UNLOCKED_PARAMEDIC_MALE == 1) {
UNLOCKED_PARAMEDIC_MALE = 1;
GUI.Label (new Rect (350, 270, 300, 30), "Unlocked Paramedic!", myLABLEstyle);
}
Your answer
Follow this Question
Related Questions
onClick.Add() with argument 0 Answers
Button Element inside text 2 Answers
How do I make a button appear when my player enters a trigger? 1 Answer
How to have one GUI button on top of another? 0 Answers
Button gets stuck in Pressed state 1 Answer