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 /
This question was closed Aug 31, 2015 at 09:07 PM by Ashky for the following reason:

The question is answered, right answer was accepted

avatar image
8
Question by Ashky · Jun 27, 2014 at 12:00 PM · 2dspritespixelsunits

What is good practice to set Pixels to Units to and how does it actually work ?

Hello Unity Community!

I have a few questions about Pixels to Units. I know that, for the default value (100), Unity considers 100 pixels to be 1 unit.

Let's say my sprites are all 128x128. Should I set Pixels to Units to 128 ? Are there optimal values that should be set for different types of projects ? As in, would you set a different value for a 2D side scroller than for a 3D action game ?

Comment
Add comment · Show 3
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 HarshadK · Jun 27, 2014 at 01:28 PM 0
Share

Since this is a subjective question I would suggest you to post it on Forum. :-)

avatar image NoseKills · Jun 27, 2014 at 03:02 PM 0
Share

The thing that most affects this decision (i'd say) is whether you need physics or not.

IF i don't need physics i might set the pixel/unit ratio to 1 and the orthographic size to half of the device's vertical resoluution. This way i get to work directly with pixels when i'm positioning my objects.

If i need 2D physics, i have to make the objects in the game roughly in the scale of 1 unity unit == 1 meter (based on the assumption that unity's box2D has the same limitations as its Flash counterpart. Don't know if its true) and then adjust orthographic size and pixel ratio based on how i want it to look.

If you dont need 2D physics you can go with the first solution too. As explained here, 3D physics can be scaled to match your world scale. $$anonymous$$aybe it works for 2D too...

avatar image Jabes22 · Oct 27, 2014 at 12:23 AM 0
Share

If you're new like me you might want to check out Unity 2D essentials on Lynda.com. You only really pay $20 bucks for the month, watch what you want, remove you subscription... The thing I'm learning is there's so much to getting this thing right. You have to take into account the tile size, unity's unit measures, then there's scripts you can attach to the camera to set it's size dynamically... The reason I mention the video by Freeman is that it mentions this... something to Google to help out is 'Unity pixel perfect camera' you should find some useful information there too... :) sorry to be drab here, I'm just at my whits end with the same problems, lol.

1 Reply

  • Sort: 
avatar image
11
Best Answer

Answer by Loius · Jun 27, 2014 at 08:37 PM

One meter is one unit (by default). So however many pixels per meter your images are is what determines your pixel-to-unit ratio. If you have 100 pixels per meter then you should use 100 pixels per unit.

This is only if you're using Unity's physics. You can change your physics settings and pixel ratio appropriately and get the same results (for example if you're dealing with planetary scales you may want one unit to equal 100 meters instead).

If you're using your own physics then you can use whatever ratio you want, it has no bearing on anything. The only guideline in that case is to keep it reasonable enough that your world will fit inside smallish world units (don't go a million units out from origin).

Comment
Add comment · Show 4 · 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
avatar image Ashky · Jun 28, 2014 at 08:07 AM 1
Share

Thank you everyone for your answers. This helped clear up a few things. $$anonymous$$aybe I'll follow up with a forum post.

avatar image RemDust · Dec 16, 2015 at 05:06 PM 0
Share

I know this is pretty old but... Does that mean that for a sprite 2048x2048px for a real size of 72x72cm I have to set my pixel per unit at... (100cm x 2048px)/72cm = 2800 ?!

avatar image wibble82 RemDust · Dec 16, 2015 at 05:13 PM 0
Share

yup! That makes sense if you think about it - you want 2048 to be less than a metee, so you end up (from your maths) saying 2800 is a meter, so 2048 gives 72cm.

avatar image RemDust wibble82 · Dec 16, 2015 at 05:34 PM 1
Share

yes I know, I did the maths before co$$anonymous$$g up with that result but I ain't never seen anybody talking about such a big pixel per unit ^^ I don't know if the physics engine is gonna be pleased with that !

Follow this Question

Answers Answers and Comments

8 People are following this question.

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

Related Questions

Unity 2d Sprite size 1 Answer

How to swap sprites? 1 Answer

Circular 9 slice? Draw a circle with constant thickness 1 Answer

Why is my sprite not the original resolution? 2 Answers

I have an animaiton problem about sprite loading. 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