c# - Unity3d : Creating GUIText On Runtime -


i trying create text describes object on runtime, guitext object created not visible. ideas ?

here code :

void enemydescriptioninit( gameobject text, string desc){     text.transform.parent = enemycar1.car.transform;     enemycar1.car.transform.position = enemycar1.startposiotion;     text.gameobject.getcomponent<guitext> ().font = new font ("arial");     text.gameobject.getcomponent<guitext>().text = desc;     text.gameobject.getcomponent<guitext>().fontsize = 40;     text.gameobject.getcomponent<guitext>().fontstyle = fontstyle.boldanditalic;     text.gameobject.getcomponent<guitext>().color = color.blue;     text.gameobject.name = "desc";  }  void start () {     player = gameobject.find ("player");      text = new gameobject();     text.addcomponent<guitext>();   }   void update(){ enemydescriptioninit (text, "hello"); } 

if you're using unity 5 try using unityengine.ui

and instead of guitextjust use text

hope helps


Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Website Login Issue developed in magento -

Can the constants be defined inside a model file of a framework in PHP? -