Author Topic: Scaling a sprite between two sprites  (Read 2348 times)

phenotype

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 22
    • View Profile
Scaling a sprite between two sprites
« on: August 25, 2012, 09:49:26 AM »
Sorry, new to NGUI so forgive me if this is dense or already documented somewhere. I couldn't find anything.

My UI has a banner across the top which is 40px high. It has a status bar across the bottom that is also 40px high. I now want to place a sliced sprite so that it scales between the banner and header bar. When I anchor it center and stretch it vertical it stretches from the top of the window to the bottom but I want it to stretch to the bottom of the banner and top of the status bar. What is the best way to do this? I noticed you have a table object but it seems to require rows to be the same height.

Thanks

Robert

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Scaling a sprite between two sprites
« Reply #1 on: August 25, 2012, 04:05:08 PM »
For this case, just create a small script that will set the localScale.y to Screen.height - 80f.

phenotype

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 22
    • View Profile
Re: Scaling a sprite between two sprites
« Reply #2 on: August 25, 2012, 08:30:23 PM »
Already done. I added height and width offsets to the UIStretch scripts. I was just wondering if there was already a widget or script that did this so I could follow the correct standard. I would recommend a split panel for future iterations that allows you to fix the size of one and dynamically scale the other.

Thanks for your help Aren.