Is there a way to automaticly size UIgridLayout?

Hello !
I’m trying to automatcly scale my inventory slot size, here is the expected result :

and here is what it does with an emulator :

Any idea on how I could fix this?

i dont really understand your question but do u want it to be smaller on specific devices? If so u would have to detect the player emulator and change the grid locally using a script when the player enters the game

Ye, my goal is to make it automatically resize depending on the device used.
– Edit –
Tried to use things like plugin but it didn’t work

You may use UIAspectRatioConstraint to handle it. It is really useful.

1 Like

I’m using one but I’m not sure if I’m using it at the right placeAlready

You must use it under the part.

while true do
		if game:GetService("UserInputService").TouchEnabled and game:GetService("UserInputService").KeyboardEnabled == false then
			print("Mobile User")
            --here u change the grid layout  for mobile and phone
			print("Probably not a Mobile User")
          --here u change the grid layout  for pc

Ye but there are many type of non keyboard user :
Console user, tablet…

That code would be helpful, but I prefer using UIAspectRatioConstraint because it is not resized for all the mobile devices with the same size. I mean, if it is 50 x 50 for tablet, but it will be same for Iphone 5.

Console users are the same layout as the pc users and u cant really do much with tablet and phone cause they are in the same category.

Yes, that’s why I’m searching if roblox didn’t plan anything for this.

You can try to use LayoutUtil for automatic UIAspectRatio.

Get it here:
LayoutUtil: Automatically sizes a ScrollingFrame’s UIGridLayout/UIListLayout - Resources / Community Resources - DevForum | Roblox

I tried to use this one, I found it in a topic. But it does the same works as the Autoscale plugin. Same result.

Can you please show me how you did it probably send me repro file?

Huhhhh… I can’t provid file, I would profide important work that isn’t mine…
To make the inventory, when the player get a new tool, it’ll clone the “Sample” textbutton to the Background frame. I tried to ut the AspectConstraint at the Handler frame, the sample and the Grid layout

You can just give me the Inventory (gui) file. (Without any scripts etc.)

Ok here is the inventoryBugInv.rbxm (13.4 KB)

1 Like

Hey your problem were offsets everywhere and I also changed the Inventory anchorpoint and position to 0.5,0.5 so it will be in the true middle for all devices.

Take it here:
FixedInv.rbxm (15.0 KB)