Author Topic: If UIStretch is obsolete, how to size background to grid?  (Read 2868 times)

raydenuni

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 18
    • View Profile
If UIStretch is obsolete, how to size background to grid?
« on: July 30, 2014, 04:34:02 PM »
I would like to set the size of a UISprite to be the size of a grid with its children. It looks like UIStretch can do that, but it's deprecated in place of the anchoring system. One can't anchor a UIWidget to a grid because a grid is not itself a widget. How should I go about populating a grid and then resizing a texture to be the size of the elements in the grid?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: If UIStretch is obsolete, how to size background to grid?
« Reply #1 on: July 31, 2014, 10:56:09 AM »
Create an invisible widget -- ALT+SHIFT+W, and attach the EnvelopContent script to it. Target the UIGrid. You can now anchor things to this invisible widget, and its bounds will be the bounds of all content underneath your grid.

Just don't make a mistake of making that widget a child of your grid or bad things will happen.