As we were laying out UI, we found that on Play, UIImageButton would resize Simple sprites back to what their actual pixel size.
Investigation led me to this thread and explanation from ArenMook:
You didn't mention using an image button. Yes, image button forcefully changes the size of your sprite to make it pixel-perfect when it changes sprites -- and this is the intended behaviour. You shouldn't stretch simple sprites, it just causes them to look blurry and distorted. Consider using a sliced sprite instead.
That makes sense, blurry sprites make me sad. But in this case we're actually reusing a larger sprite and scaling it down to fit another part of the UI. Seems pointless to make a small version for just a few use cases when the full-sized version is being used in other parts of the same UI. After looking into the UIImageButton and UISprite source I saw and remembered that a MakePixelPerfect call on a simple sprite sizes it back up to the actual pixel imensions of the image.
This isn't a big deal since we've got two workarounds:
- Render as a Sliced sprite
- Parent the sprite to an otherwise-empty GameObject and scale that parent
But this was driving our artist crazy for a good half an hour since this behavior is a bit of a surprise. It's pointless attempting to discourage scaling simple sprites because it's trivial to circumvent, and I'm not convinced that you can characterize the opposite use case--scaling down and reusing larger sprites--as an objectively bad or suboptimal use case. Are there deeper reasons for requiring a MakePixelPerfect call on every image button state change other than to discourage upscaling images?