Exploring Automatic Layouts
Now that we have the basics of manually positioning, scaling, and aligning UI elements with the Rect Transform and anchors, we can explore how to use automatic layouts. Automatic layouts allow you to group your UI elements so that they will position automatically relative to each other.
There are quite a few scenarios in which you will want Unity to automatically control the layout of your UI objects. If you are generating UI items via code and the number of items may change, but you still want them to line up, scale, and position properly, you can use automatic layouts. Also, if you want perfectly spaced UI objects, automatic layouts will help you create this perfect spacing without having to do any position calculating yourself. These automatic layouts work well for things like inventory systems aligned in a grid or list.
In this chapter, we will discuss the following topics:
- Using Layout Group components to automatically space, position...