Question by
vanillachapstick · Jan 12, 2019 at 11:35 PM ·
spriteimage
How can I get the display size of a sprite in pixels?
I am using a UI Image to display a sprite which I regularly change through scripting. When the image changes, I create a series of PolygonCollider2Ds to overlay certain parts of the image. The size and shape of these colliders are based on the original, native size of the sprite in pixels - but when the sprites are loaded into the Image, they are resized for display, and I cannot find any record of the display size. Is there a way to determine the on-screen size of a sprite in pixels when it's loaded into an image?
Comment