Icon stretching for RPG Scheme

WillyG99

Member
Hi!

How do you prevent icons being stretched in the grid inventory?
Both custom icons and single slot items have stretched aspects, is there a way to "preserve aspect"?
My 2x3 icon is 154 x 58, my 1x1 icon is 51 x 33.

Are the resolution sizes the issue?
 
This is basic Unity UI stuff. You need to play around with the anchors and stretch settings of your ItemView prefabs rectTransforms.
This video tutorial is from 2014 but I think it still applies:

I would recommend you watch more tutorials on how to scale UI. The ones for mobile games are the best for this because they explain how to scale the UI for all the different shape and size resolution of phones, which is more complicated than you would initially think
 
Ah I think I might have read your question wrong. You are using Item Shapes

In that case yes, I think you need to match the item aspect ratio with the shape size.
so a 1x1 item should be 51x51 and the 2x3 item should be 2*51x3*51 (51 is the pixel you want your base unit the be. It is up to you to decide what that is, it depends how big you want it to be on screen compared to your max resolution)
 
Ah I think I might have read your question wrong. You are using Item Shapes

In that case yes, I think you need to match the item aspect ratio with the shape size.
so a 1x1 item should be 51x51 and the 2x3 item should be 2*51x3*51 (51 is the pixel you want your base unit the be. It is up to you to decide what that is, it depends how big you want it to be on screen compared to your max resolution)
Yes that's the answer i needed, thank you so much! I will give this a try later :)
 
Top