unity3d - Text in Prefabs is Empty -


i have created text , under text there 2 input fields. have created prefabs of them , instantiated through code. , working, problem instantiated object empty , not show box, there solution problem i'm facing of.

here code

using unityengine;  using system.collections;   using system.collections.generic;  public class submitbutton : monobehaviour {  public gameobject objects;  public void start () {   //        debug.log ("ok"); }   public void instantiatebutton () {  objects.transform.position = new vector3 (57.4f, 381.58f, 0f);      instantiate (resources.load ("prefabs/bupivacaine"), new vector3 (57.4f,   381.58f, 0f), quaternion.identity); } } 

to instantiate ui object, must make sure root child of canvas. should change instantiating method:

instantiate(resources.load("prefabs/bupivacaine"), gameobject.find("parentnamehere").transform); 

enter name of parent gameobject in "parentnamehere" , remember: must child of canvas or canvas itself.


Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -