Author Topic: [BUG] Incorrect minsize on sliced sprites with pixelSize != 1 (Has fix)  (Read 2173 times)

yuriks

  • Guest
When you have a sliced sprite that uses an atlas with Pixel Size set to something other than 1 the minimum allowed size of the sprite doesn't take that into account and is calculated incorrectly.

For example, if my atlas has a sliced sprite with 32px borders, and has pixel size set to 0.5. Instead of the minimum width/height being 32 (16+16 for each border), it will be 64 (32+32 for each border) even though the borders as rendered are only 16px wide. This means you can't make the sprites as small as you'd like, which is specially a problem for progress bars.

Fix is to edit lines 252 and 269 in UISprite.cs and change
  1. Vector4 b = border;
to
  1. Vector4 b = border * atlas.pixelSize;

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: [BUG] Incorrect minsize on sliced sprites with pixelSize != 1 (Has fix)
« Reply #1 on: October 24, 2013, 11:51:40 PM »
Seems reasonable, thanks.