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 ? ?
Answer by moghes
Apr 04, 2013 at 01:48 PM
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
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.
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
i've read many questions ..
i get to know that problem is with the camera projection .. in my game its orthographic
what do you have in your main scene? what are the assets?
A couple of Cubes and a sphere..with a single camera with orthographic projection..
@mayurbhagat check this link:
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
If you are a new user, check out our FAQ for more information.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
For troubleshooting common problems with Unity 5.x Editor (including Win 10).
To help users post good questions and use the site effectively we have posted a user guide. Please check it out.
Answers and Comments
12 People are following this question.
GUI.Label question about Resolution
Resolution issue on Asus Eee Pad transformer (TF201)
2D Aspect Ratio Of Camera
Is it possible to make a custom launcher?
The infuriating Orthographic camera Vs Android Resolution.