Author Topic: Dynamic list with buttons  (Read 4231 times)

marf

  • Guest
Dynamic list with buttons
« on: May 29, 2012, 09:54:47 AM »
Hi, I'm making an online fps and I'm trying to make a server list with NGUI, in particular i need a list populated with a for each in witch there will be two columns: a label with the name of the match and a button called "Connect" that if is pressed I will connect to that game.

How I can do this?

Can I generate dynamically UIButtons?


Regards,

Marco

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Dynamic list with buttons
« Reply #1 on: May 29, 2012, 02:16:34 PM »
Create a prefab for what a single row would look like (you can keep it simple and just have 2 labels).

You then simply instantiate the prefab a few times, filling a UITable or UIGrid set to 1 column, and modifying each instance's data (labels?) as you see fit.