- Home /
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.

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:

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