Question by
soydrp · Jan 29, 2016 at 01:37 PM ·
c#instantiateoptimizationtextmeshinstantiate prefab
Less code for same thing
Hi all, thanks for reading the question. I can't seem to find a way to Access the .text property of the textmesh without doing all this typing... there's got to be a shorter way.
GameObject objCategoryLabel = Instantiate(Resources.Load("CategoryLabel"), new Vector3(0,0,0), Quaternion.identity) as GameObject;
TextMesh catLabel = new TextMesh();
catLabel = objCategoryLabel.GetComponent<TextMesh>();
catLabel.text = "At lasttt.....";
For extra points :-) - does it make any difference at runtime? meaning, is your optimized code also less resource (mem/cpu) intensive?
Thanks.
Comment
Answer by soydrp · Feb 05, 2016 at 10:24 AM
No takers? i thought this would be an interesting contest... too easy?
Your answer
Follow this Question
Related Questions
Instantiation Problem 0 Answers
Identifying the Text on the block 1 Answer
Removing Tris/Verts/Polygons from an merged mesh? (C#) 0 Answers
Im having an issue when Instantiate Prefab with specific rotation 2 Answers
Why cant I instantiate???? 2 Answers