Not Changing Text on the screen when clicked

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.

anyone?

Here you are initializing EasyAdditionQuestion as an array:

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];

and here you are trying to use it as an integer:

PlayerPrefs.SetInt("Question Number", EasyAdditionQuestion);

I am assuming you want to index into it to retrieve some number out of it, though I am not sure how you want to index into it, but it would look something like:

PlayerPrefs.SetInt("Question Number", EasyAdditionQuestion[index]);

oh soo im missing [index] Thanks - I just want it to pick a number out of 1 to 25 then when your press Play it moves to a scene and depending on what the int is depends on what the question is

EDIT: Typing EasyAdditionQuestion[index] or EasyAdditionQuestion[1, 2 , 3, 4, etc] seems to be giving me errors

Im an idiot it was simply
PlayerPrefs.SetInt(“Question Number”,(Random.Range(0, 25)));

I shoulda tried that the first time -.-