Quantcast
Channel: Questions in topic: "static variables"
Viewing all articles
Browse latest Browse all 84

Asign value of Attribute to static variable

$
0
0
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

Viewing all articles
Browse latest Browse all 84

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>