Author Topic: How to items in UIGrid on the Fly  (Read 2593 times)

asimarif

  • Guest
How to items in UIGrid on the Fly
« 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!

PoN

  • Full Member
  • ***
  • Thank You
  • -Given: 1
  • -Receive: 4
  • Posts: 111
    • View Profile
Re: How to items in UIGrid on the Fly
« Reply #1 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.  
Worked on Doc&DogAge Of Fury 3D. Actually working on WarMach.