Resolution problem


i'm new in unity .. i have developed one game according to 800 * 480 resolution and my camera Projection is orthographic .

when i run it for 800 * 480 resolution it works fine but now i want to run the same game for iphone4 , ipad wide and i see blue screen (unity default background) appears on the top and and bottom

and blue screen (unity default background) appears on the left for iphone 5 ..

i don't know what to do .. any suggestion ? ?


more ▼

asked Apr 04, 2013 at 01:35 PM

mayurbhagat gravatar image

1 1 2 4

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

Before to use any guitexture or position any guiTexture or guiText , you have to get the Screen Resolution, dpi, width and height and assign you dimensions accordingly.

Here's a simple example:

 public var myBackground:GUITexture;
 public var otherImage:GUITexture; 
 // let us say otherImage is a button(texture) at the middle of the screen
 function Start()
      myBackground.pixelInset.width = Screen.currentResolution.width;
      myBackground.pixelInset.height = Screen.currentResolution.height;
      myBackground.pixelInset.x = 0;
      myBackground.pixelInset.y = 0;
      // now ur background is full screen 
      // don't use Screen.Width in this case
      otherImage.pixelInset.width = Screen.width/4;
      otherImage.pixelInset.height = Screen.height/4;
      otherImage.pixelInset.x = Screen.width/2 - Screen.width/4;
      otherImage.pixelInset.y = Screen.height/4 - Screen.height/4;     

don't forget to set the trasform positions all to zeros in the inspector.

more ▼

answered Apr 04, 2013 at 01:48 PM

moghes gravatar image

2.4k 182 454 221

it works fine for guiTexture or guiText

the problem is with the real game .. i have made main menu using GUItexture main menu works fine problem is with the game scene

Apr 04, 2013 at 01:53 PM mayurbhagat

i've read many questions ..

i get to know that problem is with the camera projection .. in my game its orthographic

Apr 04, 2013 at 01:58 PM mayurbhagat

A couple of Cubes and a sphere..with a single camera with orthographic projection..

Apr 04, 2013 at 03:22 PM mayurbhagat

what do you have in your main scene? what are the assets?

Apr 04, 2013 at 01:59 PM moghes

@mayurbhagat check this link:

Apr 29, 2013 at 12:17 PM moghes
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments



asked: Apr 04, 2013 at 01:35 PM

Seen: 503 times

Last Updated: Apr 29, 2013 at 12:17 PM