- Home /
Question by
unitron7 · Jan 29, 2013 at 03:36 PM ·
static variables
Asign value of Attribute to static variable
Hi everybody,
I'm attaching my Script "VisibilityScript" to some GameObjects with the following Editor-Script:
class MyPostprocessor extends AssetPostprocessor {
function OnPostprocessGameObjectWithUserProperties (
go : GameObject,
propNames : String[],
values : System.Object[]){
for (var i : int = 0; i < propNames.Length; i++) {
var propName : String = propNames[i];
var value : Object = values[i];
Debug.Log("Propname: " + propName + " value: " + values[i]);
if(propName == "Start") {
go.AddComponent(VisibilityScript);
go.VisibilityScript.startValue = values[i];
Debug.Log("Start: " + VisibilityScript.startValue);
}
if(propName == "Ende") {
go.VisibilityScript.endValue = values[i];
Debug.Log("Ende:" + VisibilityScript.endValue);
}
}
}
}
It works fine. The Script gets attached to my GameObjects during import. In the script above I set some values of 2 static variables, which I have inside my VisibilityScript. But when I hit the Play-Button, the Script seems to lose the Values of my static Variables. Their values are 0. What can I do, to store these values to my static variables inside my VisibilityScript?
Thanks for your help
Comment