- Home /
Unity 2D Scaling For All Mobile Devices. What Resolution to use to keep Sprites Sharp and Avoid Blurriness?
Hello Everyone! I'm a Newbie. I have learned a lot very fast, BUT I'm stuck on a very "basic" issue. It's Scaling. What's up with that? I cant seem to find any satisfying answer related to scaling of your 2D game, Every answer is different and more confusing than prior. Could anyone be so kind to guide me.Its been ten days and Mr google seems to fail me for the first time ever.I want to learn everything about aspect ratios and what sort of resolutions to use in unity. Does it have to be Highest resolution first? How to optimize the game for all mobile devices. I have all the sprites ready in Photoshop. Feel like giving UP.,Hello! I'm a Newbie. I have learned alot very fast. BUT i have wasted 10 days on Scaling and have found "Zero" satisfying Answers.
Answer by FernandoHC · Aug 08, 2018 at 04:17 PM
The simplest answer I can think of: your image is going to be affected by the screen current resolution, therefore your images must follow the adequate size of the resolution. Let's say you have a 1920x1080 resolution (the most common one nowadays), if you want to display a sprite of that size perfectly sharp, you must have a sprite with the dimensions 1920x1080. If you want to display a perfectly sharp object of 50x50, you must have a texture of the same size, and so on. Scaling is the process of changing the position of the pixels, hiding or duplicating, of an image, so there will almost always be blurry or sharpness issues if they are scaled. Depending on the technique used.
If you want to adequate your images to every device, you can get the info at Screen.currentResolution and set your canvas to the native screen size, and use the appropriate textures for each case.
Cheers $$anonymous$$ate for replying. It cleared me $$anonymous$$d to some extent. Could you please help me further decode this sorcery?
like i have two things right now. @FernandoHC I have the landscape and menu buttons (store play etc) in illustrator(they are of high quality 8000+ resolution) and sub menus etc is in Photoshop(back button store panel pause menu etc) they are of relatively low resolution. so where do i go from here? 1.export all images one by one? without changing the resolutions of the images right? simple pngs? or simple jpegs? 2.all buttons and panels have different resolutions (50x50) (72x76) etc. What to do? 3.when i import them and put them in button and give them the native size, they take whole of canvas. should i change ppu of all sprites? 4.i have seen some projects where they have all sprites in different resolutions. what up with that? 5. The frame rate differs when i put the game in different aspect ratios. How to fix that? ($$anonymous$$y game is a side scroller game infinite)
Try having all the texture images in PNG format without compression for better quality, in the case of buttons and dynamically rect shape where you want to stretch border faces you should use 9 slice type of sprites. Have the images be in the closest resolution possible to the image size being displayed on the screen. If you change resolutions and the images change in a way that's not divisible or multiple by 2, then a new texture should be created with the new resolution. (if you notice rendering issues, don't go on crazy creating textures without even checking how the look). In the start of the project you have to define which resolutions your game is going to support, this is done so all the art can have a direction to go when creating content. If your button native size is taking over the canvas, that means your canvas is too small. Your canvas size(if root canvas) should match the native size of the screen always, unless you are forcing smaller screen sizes for performance. I would recommend using the native's device resolution always as it will work better in most cases. Framerate drop can be caused by a lot of things, including over-filling canvases. If you have huge textures, which is not recommended you should take into account that every active texture in the game scene will be drawn, no matter if inside or not the camera. So you should be careful on what you have active in the scene. Have a read at this article for more info on this: https://unity3d.com/learn/tutorials/topics/best-practices/fill-rate-canvases-and-input#child-order