Author Topic: Dynamically-sized Window? Prefab?  (Read 2298 times)

tigertrussell

  • Guest
Dynamically-sized Window? Prefab?
« on: July 05, 2013, 02:42:00 AM »
Hello all,

I am trying to make a small window that will display controls for my actively selected units. I want it to show a vertical list of buttons, each one of them saying "X Shotgunners," etc. Then I want to bind an event to each of those buttons.

I'm finding great tutorials for how to make static GUIs with ngui, but not much on how to make something dynamic like this, where the background window surrounding the buttons will resize and the buttons themselves will change based on other parts of a game.

If anybody could point me in the right direction, I'd greatly appreciate it.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Dynamically-sized Window? Prefab?
« Reply #1 on: July 05, 2013, 08:22:46 AM »
Look at the UITooltip and how it scales its background to envelop the content. That should be a good starting point.

tigertrussell

  • Guest
Re: Dynamically-sized Window? Prefab?
« Reply #2 on: July 05, 2013, 03:41:23 PM »
Cool, this is helpful.

If I create a button with an icon and a label and save it as a prefab, is there a way to get the height of that entire prefab?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Dynamically-sized Window? Prefab?
« Reply #3 on: July 05, 2013, 08:10:24 PM »
NGUIMath.Calculate### series of functions