Inventory buttion scaling works correctly on pc but not mobile

I am trying to use this custom hotbar for my game and it creates and scales the buttions correctly on any pc device but not on mobile

Code:

PC Screenshot (buttion scaled correctly):

Mobile buttion scaled too large!:

I have already tried using UISizeConstraint and most scaling plugins but nothing worked I have tried looking at the code creating the buttions but I can’t understand can someone help?

1 Like

Hello, first of all, I might suggest for you to use a UIListLayout to automatically manage the positioning in your frame. Using this, you can position and size your frame however you like using scale values and the inner objects will be positioned/adjusted automatically.

You can then have inner UI objects maintain a square shape using UIAspaceRatioConstraints with AspectRatio 1 and having its Y size scale equal to 1. You can also use a UIAspectRatioConstraint to auto-size the frame to maintain its shape.

I know this is a bunch of UI stuff that may seem confusing at first, so I would highly suggest reading the docs linked above related to the objects. If you still need help, feel free to let me know!

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.