Refresh inspector view after changing code

Hi…

I can’t seem to refresh the inspector after I change my code
I am sure it’s a very basic action
but I can’t seem to find it anywhere

example:
create new code,
attach it to some go,
on the inspector you can see the script

add new parameter:
var param : boolean = true;
save the code
the param is shown on the inspector - signed as true (check box is checked)

now change to:
var param : boolean = false;
save the code
on the code the change is saved but on the inspector it is still signed as true
I have to un-check the check-box myself

how do I keep the inspector fit the code??

That’s not how public variables work…they always take their values from the inspector. It would be very bad if you spent a lot of time tweaking all your public variables, only to have them obliterated and set back to the defaults specified by the script whenever you happened to save it.

–Eric

True, I don’t intend to change them through the script, but sometimes I do have to change my code
(I don’t know about you, but my code is not perfect the first time I save it… :smile: )

it was just an example to explain my problem…
you can see here a more relalvant case: http://forum.unity3d.com/viewtopic.php?t=54619

One way is to declare the variable as private, save your code, then change it back to public.

Or just do this:

var myBoolean : boolean;

function Awake(){
	myBoolean = true;	
}

Whatever is in Awake will over-ride the inspector once you hit Play.