The questions I've seen are outdated, explained, not to my liking, or just don't work.

Problem: I want to be able to create a game that can scale on all mobile devices with ease and with no pixelation.

Extra Info:

  • I'm very new to unity and tackling the the software with all my might I'm sorry for being a noob.
  • I already paired unity with my phone and set the build to android (Nexus 5).
  • Aspect ratio is 10:16, The game is going to be portrait.
  • I have no scripts or anything, Its legit a blank game with a camera that has a blue background.

I have some pictures, if you need anything else for my assistance don't hesitate I'm here to learn and take, GULP, Constructive Criticism.


enter image description here


enter image description here

  • \$\begingroup\$ What kind of image is that? Is it a vector format or a normal pixelformat? Also what resolution are you using for it? \$\endgroup\$ Commented Jan 12, 2017 at 18:42
  • \$\begingroup\$ @UnholySheep Its vector and I and will get the size when my classes finish. I screenshot the android screen and gyazo my CPU lol don't roast me for using gyazo \$\endgroup\$
    – Dino Alves
    Commented Jan 12, 2017 at 18:47
  • \$\begingroup\$ I'd also like to add, not just scaling this one icon. I want everything I add to be well scaled such as background, sprites, etc. \$\endgroup\$
    – Dino Alves
    Commented Jan 12, 2017 at 20:07
  • \$\begingroup\$ @UnholySheep 255x255 \$\endgroup\$
    – Dino Alves
    Commented Jan 12, 2017 at 22:15
  • \$\begingroup\$ scaling would be to float xScale = 255 / Screen.Height; float yScale = 255 / Screen.Width; Then apply the scales to the objects height and width but i dont know how to get the objects dimensions and set them. I dont even know if my thinking is correct If this is true I can just use this script on every object and it will scale everything but I dont know if thats the proper way to do things also :PPP \$\endgroup\$
    – Dino Alves
    Commented Jan 13, 2017 at 0:07

3 Answers 3


Based on the comment I'm typing this just to provide an answer.

Unity remote DOES NOT BUILD I repeat DOES NOT BUILD to the target device. What it does is send a compressed video stream to the device. It is mainly used to test touch inputs and gyro stuff and so on because it can send the device input back to the editor. The quality is always bad when using Unity remote.


scaling to screen size is very easy in unity. you can use canvas scaler and give it a reference resolution (try to give it as higher as possible).

enter image description here

Here is the step to use UI Canvas

  1. GameObject > UI > Canvas
  2. Select Canvas > GameObject > UI > Image
  3. In Image Component's Source Image > Add your Image
  4. Go Back to Canvas Find Canvas Scaler which looks like the image i attached and try to play with the value if you don't find a proper solution.

I hope this solves your problem. Cheers!


If you don't understand code , UI / Canvas is your last option

what i suggest that is your main idea is to make your picture / game object look in same position and look same big as if at other resolution , i have the script ( i tell you how to install it at the bottom of the page ) for it but unfortunally , i can't make it automatically scale all your game object ( one by one ) , the script still scale at aspect ratio but you can't use the script if you build the game using aspect ratio resolution ( must be fixed resolution , because the script itself , explained later) .

this is the script for 2D version ( because your game is 2D ) :

using UnityEngine;
using System.Collections; 
public class calculateresolution : MonoBehaviour {

void CalculateResolution(string theobjectm , float resolutionwidthyouusetobuild , float resolutionheightyouusetobuild ) {

GameObject objecttocalculate = GameObject.Find(theobjectm);
float desiredscreenheight = resolutionheightyouusetobuild;
float desiredscreenwidth = resolutionwidthyouusetobuild;   
float desiredaspectratio = desiredscreenwidth / desiredscreenheight;
float desiredaspectratioheight = desiredscreenheight / desiredscreenwidth;
float screenheight = Screen.height;
float screenwidth = Screen.width;
float aspectratioheight = screenheight / screenwidth;
float aspectratiowidth = screenwidth / screenheight;
float objectsizex = objecttocalculate.transform.localScale.x;
float objectsizey = objecttocalculate.transform.localScale.y;
float objectsizez = objecttocalculate.transform.localScale.z;
float objectcoordx = objecttocalculate.transform.localPosition.x;
float objectcoordy = objecttocalculate.transform.localPosition.y;
float objectcoordz = objecttocalculate.transform.localPosition.z;
float newobjectsizex = aspectratiowidth / desiredaspectratiowidth * objectsizex;
float newobjectsizey = objectsizey;
float newobjectsizez = objectsizez;
float newobjectcoordx = aspectratiowidth / desiredaspectratiowidth * objectcoordx;   
float newobjectcoordy = aspectratioheight / desiredaspectratioheight * objectcoordy;   
float newobjectcoordz = objectcoordz;
objecttocalculate.transform.localScale = new Vector3(newobjectsizex,newobjectsizey,newobjectsizez);
objecttocalculate.transform.localPosition = new Vector3(newobjectcoordx,newobjectcoordy,newobjectcoordz);    
void Start() {

// Example i build my game at fixed resolution 1366 x 768    
// 1366 is resolution width , and 768 is resolution height 
// and i have GameObject ( such as picture , ect ) named pictureone in the hierarcy  
// put this magical command inside Start() { }   
// if you don't know where is the inside , just remove the 2 backslash and change the pictureone into your object name   
// don't forget to change 1366 and 768 with your screen width and screen height ! 
// \/ the magical command \/
// CalculateResolution("pictureone",1366f,768f);
// /\ the magical command /\
void Update() {


The how-to-use the script is explained inside function Start() , now :

Installation :
1. Create any object ( or just put another picture if you don't understand how to create object ) 2. Create new C# script by Assets menu at top part ( beside GameObject and Edit ) , Create > , C# Script , and then name the script with name calculateresolution . 3. add the script component ( not working yet ) to object , if you don't understand , drag the script into the object you created at step one from hierarchy .
4. Open and edit the script
5. Copy all the script above
6. paste the code to the editor
7. then test it ( without modifying it ) , if its give error , then you have done wrong in previous step , go back and take a look where you are wrong .
8. If the script give no error , then edit the script as i explained in the Start() .
9. If you don't understand code , UI / Canvas is your last option .
10 . Do not lie to script about what resolution you are using , else it will do wrong .

This script only scale when you run the game first time ( did not change if you change the resolution in-game ) , also did not run if you didn't run the game .

Also this not fix your second problem , if player use resolution that is higher than resolution you use to make the game , the picture / sprite still get blurry a little .

If you still don't understand , contact me [email protected]


  • \$\begingroup\$ If you already done the step right and already checked you are not wrong , tell me i fix it \$\endgroup\$ Commented Jan 13, 2017 at 16:48
  • \$\begingroup\$ EDIT : sorry ! forget one "}" \$\endgroup\$ Commented Jan 13, 2017 at 16:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .