Ok, so I have buttons in a frame with a UIGridLayout inside of it.
I want to change a button’s size when it gets hovered, but the size is restrained by the UIGridLayout.
Is there a way I can only change that button’s size without changing the size of the rest of the buttons?
As far as I’m aware, UIListLayout only controls the spacing/padding between the buttons (What restricts the size is the UIGridLayout).
Normally with these things you could do a simple MouseEnter and MouseLeave:Connect() where whenever it enters, you can have it expand it’s size and then when it leaves, bring back to normal.
In this case, right now UIGridLayout doesn’t neccesarily have that ability in its properties to where hovering can increase one button’s size, may require extensive scripting. May I ask if you can send a picture of how your current UI looks like atm?
This is unless the current UI design requires the usage of a grid design. If the current design caters to a list then yeah, just pretty much what I mentioned above to help achieve the effect:Help with UIListLayout - #3 by w4570
I think it does have that ability, I have seen games that almost definitely use grid layouts and they have hover effects where the buttons change sizes.
Just want to establish that a part of the UIGridLayout properties is “CellSize” which basically already establishes what size each cell grid should be. If ever it’s manipulated, it will apply for all cell as well and not just one.
BUT, If I were to think of a workaround to this, You could possibly have something where each button of the Grid is stored in a frame (So the UIGridLayout is setting the grid size for every frame and in each frame stores a button that maybe has a size of lets say 0.8, 0, 0.8,0). From there just apply the same logic as the mouse enter and leave.
That is possibly the best I can come up with to work around the current nature of the UIGridLayout.
So yeah you can have a for loop store all the elements. If v.TextButton is a Text Button then, MouseEnter:Connect() leads to TweenSize to 0.99. MouseLeave:Connect() leads to TweenSize to 0.85
I figured out a solution using UISizeConstraints. I didn’t even know these existed, since I was just messing around with constraints until I found this out. I basically just set the MaxSize property of the size constraint to be smaller when the mouse enters the button, and larger when the mouse leaves.