- Home /
Change Sprite size in pixels.
Hi, is it possible to change size of sprites in pixels, not using the transform.scale?
I want to be able to change sprite height/width via script but I can't use scaling. Optional example can be in both C# and UnityScript :).
Thanks in advance,
Paul
Why can you use transform.scale? If you go to the sprite import settings then and change the "Pixel to unit" value to the dimension of your sprite then it will scale perfectly.
@Nodgez i need them to be pixel-perfect. Game I making now have old-school graphics and res of sprites is just very low so when I place one sprite on top of another and if they won't snap perfectly it won't be looking good. As You know (or not) when colors are for ex. red and green even one pixel can be observed.
I dont really understand. Do you want to make a Texture file larger, or you want it to be visually larger without it getting blurry?
@vikingfabian I want to scale sprites but not using transforms scale but size in pixel for ex. change sprite width to 999 pixels
Did you try the last recommendation? Did it solve your question? If you found a satisfactory answer to your question please respond it with the solution, that will be very helpful for future reference. Thanks for your comprehension, Unity Support.
Answer by nesis · Feb 07, 2014 at 03:43 PM
Camera orthogonal size, viewport resolution, and pixels-to-units are what you need to modify to get a pixel perfect mapping of sprite pixels to screen pixels.
Your answer
Follow this Question
Related Questions
How to make sprites occupy the same screen space on different resolutions ? 1 Answer
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
How can I set the position and size of a sprite from inside a script ? 1 Answer
How do I get the bounds of a sprite on its sprite atlas? 0 Answers