# How can I set up Unity so that 2d images are displayed in their original resolution?

I took images from my iOS game that I am developing in SpriteKit and put them in a Unity Android 1136x640 screen, which are the same dimensions for the iOS game but the images are a lot smaller. How can I get a similar representation that coincides with the screen size? I would like a 284x640 image to be displayed to take a quarter of the screen width, which is what happens in reality.

• you want the picture to fit the background? – Leggy7 Apr 2 '16 at 14:41
• I want a general way solve the issue of images being smaller or bigger so that they appear according to their real size. As I stated above, for example 1136/4 is 284, so if I set the width of an image to 284, it will always occupy a 4th of the screen width. – Jickery Apr 2 '16 at 14:56

There are several things which affect sprite scaling in Unity.

• When you import a sprite in Unity, there is a setting Pixels per unit for the sprite asset in your project folder structure. Use this setting to scale the sprite.
• All Game objects have a Scale X, Y and Z in their Transform-component which makes them larger or smaller. Note that the scale of a parent game-object also affects all of its child-objects.
• When your camera is set to Projection: Orthographic, then the property Size defines how many units fit on the screen.
• When your camera is set to Projection: Perspective, then objects closer to the camera will look larger than those further away. The Field of View also allows you to control the zoom factor.

When your camera is orthographic, then the vertical height of the viewport in Unity units is twice the camera size. That means to get 1 px image = 1px on screen, set the Pixels per unit to your vertical screen resolution divided by twice the camera size.

When you have a camera size of 5 (default) and you target a 640px high display, set the ppu to 640 / (5 * 2) = 64.

You might also want to set the Filter Mode of your images to "Point (no filter)" to avoid sprites getting blurred when their positions are not perfectly on-pixel.

• Thanks for putting things in perspective. Isn't there a way that I can adjust all these parameters to arrive at a screen dimension representation of my images that can be applied to all images?Otherwise, I don't see how I can create I replica of my SpriteKit game using Unity. I am primarily working in 2d, hence using orthographic projection. – Jickery Apr 2 '16 at 20:22
• @Jickery I updated the answer with an example calculation. – Philipp Apr 2 '16 at 20:39

Select your canvas and set the canvas scaler to scale with screen size. This way whatever is your image size it will be resized according to your screen resolutions.

• I didn't have a canvas in my game, when I added the canvas, it didn't change anything. – Jickery Apr 2 '16 at 15:20
• could add some screenshot to give a better view of the problem? Please show your canvas and the hierarchy. – Leggy7 Apr 2 '16 at 15:33

If you select your image and make sure it's set as a sprite, you'll notice an import property called pixels per unit. Changing this will change the scale of your sprite. There are other factors though, such as the camera settings. It sounds like what you're looking for is pixel perfect rendering. Here's a good resource for that: http://blogs.unity3d.com/2015/06/19/pixel-perfect-2d/