- Home /
Create placeholders in grid layout group?
I recently started using the layout groups which made working on my game 10x easier.
But I was wondering if there was a way to make the grid layout group cells in static positions? Like stop them from auto arranging to top left etc. Or would I have do create cells equivalent to my grid size and make them placeholders for my objects?
Answer by lgarczyn · Mar 15, 2017 at 12:34 PM
No. You need to either create your own grid layout (not recommended, there are a lot of things to take in account), or simply place elements in every grid position, that can be empty or full.
Thanks for the suggestion. I figured out a work around though.
I filled my entire grid with invisible objects and made them act as placeholders to hold my "items". Then I created an array for the placeholders. I checked the index position of the current placeholder and set its index position where I wanted it to and made the item I wanted a child of current placeholder and made sure its position and size was the same using the grid layout.
It might help someone else or might not.
Your answer
![](https://koobas.hobune.stream/wayback/20220612112838im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to Stretch objects in grid layout when screen size is changed 0 Answers
Why doesn't childing a gameobject to GridLayoutGroup at runtime align it properly? 1 Answer
How can I make Horizontal Layout Group starts from right to left? 4 Answers
UI Layout Moves after you save or touch it in the Editor 0 Answers
Dynamically added buttons aren't aligned in GridLayoutGroup 0 Answers