sbs_ramim
Reel Rookie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2020
08:44 AM
Centering items using LayoutGroup
I feel very stupid as I ask this but I don't know why I cannot horizontally center items on the screen. So this is what I have under my "MainScene" children node:
<LayoutGroup width="2560" height="500" layoutDirection="horiz" horizAlignment="center" vertAlignment="center" > <Rectangle width="500" height="500" color="0xff0000ff" horizAlignment="center" vertAlignment="center" /> </LayoutGroup>
As you can see, I've set alignment as "center" in both the parent and the child rectangle, and I've tried switching between layout direction "horiz" and "vert", but still, the red square appears at the top left corner. Can someone identify what am I doing wrong here?
Thank you