Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: Alex on April 16, 2012, 05:37:42 AM
-
Hi,
I've created a prefab with a bunch of widgets on it in order to instantiate it dynamically.
this is the settings of it:
*ItemLevel <-- Game Object
** labelLevel
** labelScore
** icon1
** icon2
to instantiate it i do:
GameObject go = (GameObject)Instantiate((GameObject)itemLevelPrefab, Vector3.zero, Quaternion.identity );
and then parent it like:
go.transform.parent = myPanel.transform;
The problem is that the ItemLevel become very very huge.
I know i can use:go.transform.localScale = vector3.one
but the question is if there is another option to overcome this problem since i'm not sure
what will happened in term of performance ( for ios ) because of the stretching thing.
Thanks
-
That's why there is NGUITools.AddChild. Use that to instantiate your objects instead of Object.Instantiate. It will also do the parenting and scaling for you.