hyper
June 9, 2010, 9:29pm
1
so, i have a script (js) like that:
var a;
var b;
var c;
c = a + b;
after i attach this script to an object, i wonder if there is any way in that if i change the values of a or b, to see the new "c" in inspector... some kind of input text for a and b and dynamic text for c.
system
June 9, 2010, 10:10pm
2
As unity does not display properties with getters/setters, your best bet would be writing a custom inspector .
Tetrad
June 9, 2010, 10:14pm
3
Try playing around with ExecuteInEditMode .
So like this:
@script ExecuteInEditMode()
var a;
var b;
var c;
void Update()
{
c = a + b;
}
(I haven't tested this.)
hyper
June 10, 2010, 1:01am
4
yep, this is working! thanks!
i just added the var types for a,b,c, i get some errors if not...
here is the javascript version:
@script ExecuteInEditMode()
var a:float;
var b:float;
var c:float;
function Update() {
c = a + b;
}