Hi, im wanting it to change a Player Pref depending on what the variable is but it doesn’t seem to be changing im using java script heres my code - I don’t see whats wrong with it.
function Start () {
}
function Update () {
var EasyAdditionQuestion : int[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25];
}
function OnGUI () {
if (GUI.Button (new Rect (Screen.width/9.95f, Screen.height/33.35f, Screen.width/1.25f,Screen.height/8.00f),"",TitleButton))
{
Application.LoadLevel(LevelCurrentLevel);
}
if (GUI.Button (new Rect (Screen.width/9.95f, Screen.height/5.35f, Screen.width/1.25f,Screen.height/8.00f),"",LevelOneButton))
{
PlayerPrefs.SetInt("Question Number", EasyAdditionQuestion);
Application.LoadLevel("Question Scene");
}
}
Then when it loads the scene Question Scene I have
function Start () {
}
function Update () {
}
function OnGUI () {
GUI.Label (new Rect (Screen.width/4.50f,Screen.height/3.00f,Screen.width/1.50f,Screen.height/10.2f),PlayerPrefs.GetString("Question Writing"), textStyle);
if (PlayerPrefs.GetInt("Question Number")==1)
{
PlayerPrefs.SetString("Question Writing", "[ 1 + 2 ]");
}
if (PlayerPrefs.GetInt("Question Number")==2)
{
PlayerPrefs.SetString("Question Writing", "[ 1 + 1 ]");
}
if (PlayerPrefs.GetInt("Question Number")==3)
{
PlayerPrefs.SetString("Question Writing", "[ 2 + 4 ]");
}
if (PlayerPrefs.GetInt("Question Number")==4)
{
PlayerPrefs.SetString("Question Writing", "[ 3 + 3 ]");
}
if (PlayerPrefs.GetInt("Question Number")==5)
{
PlayerPrefs.SetString("Question Writing", "[ 7 + 1 ]");
}
}
I do have the Variables already added I just haven’t typed them in to this thread but they are in the scripts, I don’t see what the issue is?
Thank you in advance.