- Home /
Vertical Layout Group, how to set different child aligments
Hello everyone! Im making a simple tooltip that expands as content grows in it and it works like a charm, child alignment is set to middle to center, but how can i have Lower Left alignment for some childs and middle for another?
As you can see from picture Name and description needs to have middle alignment and parameters need to have lower left alignment, so how can i set different aligments in a vertical layout group?
Answer by Hellium · Jan 03, 2017 at 05:49 PM
I would manage the alignment inside the items, not through the layout.
In the vertical layout, set the alignment to middle center, and expand width
Each layout item is an empty filling as much place as possible
Inside each item, play with the anchor points to align the sub-elements to the left / the center / the right
This works,but if i set child force expand width, it will maximize width of the main box.
$$anonymous$$mh, which element do you want to align to the left ? I don't quite understand your hierarchy
Could you share a Unity package with your "dialogue box" as a prefab so I can take a look at it ?
Ok, I see you have Vertical Layout groups nearly everywhere ^^
Here is a solution I found. I don't know if it will fit your needs :
Tooltip_Skills [ContentSizeFitter] : Change
Horizontal fit
toPreffered size
Parameters : Add a [LayoutElement] component and check the
Flexible Width
with a value set to 1
I guess you will not be able to do what you want without making the box fill your Tooltip_Skill image
Im using this layout to set max width: http://hilllo.com/limit-max-width-of-a-layout-component-in-unity/
So when it its small when there is not too much content, but if its too big, it wont expand forever :D
Wow, not related to your question but thanks for visiting my blog! :D
Your answer
Follow this Question
Related Questions
Create placeholders in grid layout group? 1 Answer
How can I make Horizontal Layout Group starts from right to left? 4 Answers
Content size fitter alignment issue 1 Answer
UI Layout Moves after you save or touch it in the Editor 0 Answers
Can't animate UI element whose values are controlled by a layout group 0 Answers