- Home /
Can't resize properly
I have a panel, which has a bunch of buttons as Child, i want the panel to resize so that the buttons fit perfekt. but if i asign a conten size fitter it just shrinks the panel to nearly nothing, i tried to add a vertical layout group, which causes the buttons be tottaly deformed. then i tried to turn of the child expansion, but that shrinks my buttons to nearly nothing.
How can i resize the Panel to fitt the buttons without destroying the burrons ?
Answer by HammerCar · Jun 20, 2015 at 12:31 PM
You simply have to make the anchor of your gui elements the size of that gui element. Then they should resize properly.
I can only set the ankors to the size of the panel not the button himself and i did not change anything
If you parented the button to the panel the anchor has to be in the panel. You can still parent it to the canvas, then resize the anchor and then parent it back to the panel. I think that should work.
If i make to child of the canvas it sets the anker to the borders of the canvas and if i make it a child of the panel again it resizes to the border of the panel agien :(
Parent it to the canvas, then resize the anchor to be the size of the gui element, then parent it back to the panel.
To resize the anchor click and hold on one of the anchor things and drag it as close to the gui elements corner as you can. Do this for all of the corners. Then go to the inspector and set the right, left, top and bottom values to 0.
Your answer
Follow this Question
Related Questions
Button onClick events will not be triggered 1 Answer
In game right click menu 1 Answer
Clicking Trigger 1 Answer
gui text button dont work 1 Answer