Variables dont update in a GUI Script

Hi Folks!

I am using the following code and wonder why the content of the variables wont change if I change it.
After pressing the “Play”-Button the GUI always shows the first compiled version of the script.
On the other while changing the rectangle values the textfield is updating.

What am I doing wrong?

var textFieldString = “bla, bla”;
var header = “bla, bla”;
var keysnavi = “bla, bla”;
var arrownavi = “bla, bla”;
var mousenavi = “bla, bla”;

function OnGUI () {
textFieldString = GUI.TextField (Rect (5, 5, 250, 75), header + keysnavi +arrownavi + mousenavi);
}

greetz!


Ok, found my mistake - either right klick on the name of the script and klick reset (if you made changes in the scriptfile) or edit the values directly in the inspector. A list of the variables should exist there.

In your code, only textFieldString will ever change as you store the result of the TextField changes there. However the TextField will always show the same text (and as a consequence, textFieldString will only ever briefly change for a single frame) since the input for the text field never changes - which is: header + keysnavi +arrownavi + mousenavi.