0
\$\begingroup\$

I'm just a beginner in Unity, so basically, I want to find out the exact measurement unity of the raw image so that I can now design in photoshop. I tried in Pixels in photoshop but when I import it in unity, it seems that the image is stretched out. I also tried mm, cm, inch but none of these worked. How to scale it so that my designed image's dimensions in photoshop will be exactly the same as the dimensions in unity? How to scale it?

enter description here

enter image description here

I tried pixels in photoshop but the image is stretched out indicating that it is not the right measurement unit.

\$\endgroup\$
  • \$\begingroup\$ I'm curious why you're using a RawImage for this purpose, rather than an Image or SpriteRenderer component. \$\endgroup\$ – DMGregory Nov 7 '18 at 21:20
1
\$\begingroup\$

There is no 1:1 relationship between the size reported by the Rect Transform and pixels. The actual (pixel) size on screen depends on the resolution (chosen by the end user) and the settings of your canvas.

If your canvas size is set to, say, 1920x1080, it will be pixel perfect only when the game is run in (full screen) 1920x1080. In other all other resolutions or window sizes, Unity will perform some scaling to compensate - which is usually what you want. Someone running at a lower resolution should still be able to see the entire UI.

With the canvas set to 1920x1080 and running at that resolution, the pixel values will match up though. I.e. a UI element with a width of 500 is 500px wide at that resolution.

I'd, however, recommend designing your UI elements for a higher resolution than your main target (unless you are targeting a platform with a fixed resolution). In my own game, for example, the UI was designed for a 1080p display, but I created all the art at 4x resolution so that the UI will scale nicely for someone running on a 4K screen (which, as time progresses, will only become more and more common).

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.