#UI texture rect

7 messages · Page 1 of 1 (latest)

hexed comet
#

What you are setting is the “region” which is used to change what portion of the source sprite is drawn. So if you only wanted the top half of that sprite you could set region to (16,8) starting at (0,0)

Since your rectangle is in a grid container, it will be sized based on the grid container’s properties. If you don’t want that behavior you will want to change your scene organization.

If you do want to “stretch” your square to be longer but want it to scale properly, you should use a NinePatchRect as you can set what parts of the texture are corners or borders and make it whatever size you want without stretching the sprite.

agile frigate
# hexed comet What you are setting is the “region” which is used to change what portion of the...

im not quite following, my goal is to just have the 16x16 square image but its been stretched vertically. it even reads as 16x16 in the inspector(when i attempt to change it there it preserves the weird stretch)

i tried changing where the texture rect was in the scene but it just warped the image in different ways.

the issue isnt with the corners and borders, i wanted to know what was causing the weird vertical stretch in the scene

hexed comet
agile frigate
hexed comet
#

By selecting the grid container, then I think it is under Container on the right panel? I avoid using them personally but I bet people in the #ui channel would be better able to help with what specific settings to use

agile frigate
#

ok, thanks