Author Topic: Item Level Selection  (Read 2988 times)

Alex

  • Guest
Item Level Selection
« 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

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Item Level Selection
« Reply #1 on: April 16, 2012, 09:35:07 AM »
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.