Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by legion_44 · Feb 06, 2014 at 06:48 PM · c#spritesizepixel

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

Comment
Add comment · Show 5
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Nodgez · Feb 06, 2014 at 08:16 PM 0
Share

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.

avatar image legion_44 · Feb 06, 2014 at 10:55 PM 0
Share

@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.

avatar image vikingfabian-com · Feb 07, 2014 at 10:49 AM 0
Share

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?

avatar image legion_44 · Feb 07, 2014 at 03:23 PM 0
Share

@vikingfabian I want to scale sprites but not using transforms scale but size in pixel for ex. change sprite width to 999 pixels

avatar image unimechanic ♦♦ · Feb 21, 2014 at 11:45 PM 0
Share

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.

1 Reply

· Add your reply
  • Sort: 
avatar image
2
Best Answer

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.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

23 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

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


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges