Search Unity

Set RectTransform to contain all its children

Discussion in 'UGUI & TextMesh Pro' started by ferretnt, Feb 26, 2019.

  1. ferretnt

    ferretnt

    Joined:
    Apr 10, 2012
    Posts:
    412
    Is there a quick way in the editor to perform common operations for setting up parents around groups of objects like:

    "Make this RectTransform enclose all its children?"
    "Make this RectTransform enclose all of its children with the pivot at the origin of the chilren's encapsulated bounds".

    (Typically so you can then turn them into a prefab with some useful pivot and scaling behaviour.

    I know how to do this in code. I could bind those functions to editor keys. I just don't understand what I'm missing that I have to do that.

    Please don't say to use the AutoLayout components. Even after reading the source code I'm yet to determine the logic behind them. This isn't for autolayout. It's typically for setting up prefabs of bits of UI after we've imported them as photoshop layers.