Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: asimarif on January 23, 2013, 05:36:52 AM

Title: How to items in UIGrid on the Fly
Post by: asimarif on January 23, 2013, 05:36:52 AM
Hi,
I have a prefab which I would like to add in the Grid. Can someone please share me a code for this because I'm really unable to do this... :(

Thank you!
Title: Re: How to items in UIGrid on the Fly
Post by: PoN on January 23, 2013, 06:42:37 AM
  1. public UIGrid refGrid;
  2. public GameObject your_prefab;
  3.  
  4. private void YourMethod()
  5. {
  6.     GameObject currObj = NGUITools.AddChild (refGrid.gameObject, your_prefab);
  7.     refGrid.repositionNow = true;
  8. }
  9.