Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 DragonautX · Feb 05, 2017 at 05:41 PM · canvas

What does 'Reference Pixels per Unit' change visually?

In a canvas, I have the "Canvas Scaler" set to "Scale with Screen Size", and I have a text and a Create -> Sprites -> Square in the canvas. Out of curiosity, I tried changing the "Reference Pixels Per Unit" 100 to 50 and other numbers, but that didn't seem to change anything when I pressed "Play".

How can "Reference Pixels Per Unit" make a noticeable change? "Pixels Per Unit" in the Square's import settings actually changes the square's size, from what I can see, but I'm wondering what "Reference Pixels Per Unit" changes.

alt text

2017-02-05-09-39-46-unity-551f1-personal-64bit-new.png (11.4 kB)
Comment
Add comment
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

3 Replies

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

Answer by zzxiang · Oct 10, 2018 at 07:52 AM

Just did an experiment. Sprite with pixels per unit set to 100 and canvas with reference per unit set to 200 will make the sprite shown twice larger than sprite with pixels per unit set to 100 and canvas with reference per unit set to 100. But in order to make the change happen visually, you need to click Set Native Size of the Image:

alt text

Comment
Add comment · Show 1 · 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 DragonautX · Oct 11, 2018 at 06:33 AM 0
Share

-Nice find. I verified this in the Unity I installed long ago, in the 2017.1.1f1 Personal version I installed a long time ago, with a Create->UI->Image command and setting the Source Image to the given Checkmark image. Like I made in a comment in IgorAherne's answer, I still haven't used Unity in a long time. I browsed through the Canvas Scaler and the Image UI control again to read about the "Reference Pixels Per Unit" input and "Set Native Size" button.

-The description for the "Reference Pixels" thing sounds opposite of what you found, that the "one pixel in the sprite will cover one unit in the UI" phrase I read seems to mean that the higher you set in the "Reference Pixels" input box, the more pixels will be packed into a Unity unit, which would mean an image should look smaller on the screen. But since your results showed otherwise, I guess I'm supposed to interpret it as: "the higher you set the 'Reference Pixels' options, the more units will be taken to represent one pixel, therefore increasing the image size". Odd wording, overall.

-Anyways, again, thanks for your answer. Nice to get some close here after I posted this more than a year ago. I wish the docs could've more clearly talked about the "Set Native Size" button and its relation to this "Reference Pixels" thing.

avatar image
1

Answer by shdwjk · Jan 28, 2018 at 06:10 PM

From: https://docs.unity3d.com/Manual/script-CanvasScaler.html

Reference Pixels Per Unit: If a sprite has this ‘Pixels Per Unit’ setting, then one pixel in the sprite will cover one unit in the UI.

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
avatar image
0

Answer by IgorAherne · Oct 24, 2017 at 03:17 PM

I suspect it means "how many pixels occupy 1 world unit" in other words, how many pixels fit in one-meter distance

Comment
Add comment · Show 1 · 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 DragonautX · Oct 27, 2017 at 05:05 PM 1
Share

That could be one meaning for it. I don't think 1 world unit has to necessarily be 1 meter. I looked at the user docs for the Canvas Scaler component, and in general, for different UI Scale $$anonymous$$odes, "Reference Pixels per Unit" is supposed to influence how one pixel in a sprite that uses a "Pixels Per Unit" setting is scaled in the game.

Nonetheless, I opened up a new Unity project, and I still can't make anything look different by changing that number. Can you get it to change something? I posted this 8 months ago, I don't use Unity anymore, but it'd still be nice to know about it.

There's also a C# property called Canvas.referencePixelsPerUnit that talks about pixel density. I think that means "pixels per unit", like you mentioned. Not sure if that could help answer this, will just post it here as a note.

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

66 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 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 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

Is it possible to change the canvas size in 2D? 0 Answers

Array Out of Index (When it Really is not??) 1 Answer

How can i make it so my HUD stops blocking my pause menu from being usable? 1 Answer

UI image showing up "behind" player. 2 Answers

Detect when UI element in canvas overlaps with moving game object and then make element follow object 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