If I want to set up my orthographic camera so the background fits perfectly to fit an iPhone 5c what would I do? I’ve been searching and I can’t figure it out, I’m not sure how to change the screen and height of the camera and I’m not sure what it would need to be for an iPhone
In the Game window, set the aspect ratio to whatever the phone is. An iPhone 5 claims to be 16:9. That will automatically scale the camera the proper amount.
In Unity’s case, it uses the actual size for half the short side. So, if you set the ortho camera to size 10, the background will be 20 tall (10 in each direction) and 16/9*20 = 35.5 wide.
It feels funny that it isn’t a camera setting. Instead, the camera is “smart” and will resize to whatever the screen is. So you just have to make the game using that ratio. It also doesn’t care about pixels. If you make the game using 1600x900, it will fit the same on 160x90.
Here is how I h[22240-bgtest.zip|22240]ave solved background texture display that fit all resolution.
- Create a GUITexture: Menu->GameObject->Create other->GUI Texture
- In Inspector under Transform change scale to 1 for x and y.
- In Inspector under GUITexture add your background texture and change all values in Pixel inset to 0. x = 0, y = 0, w = 0, and H = 0.
- Create a new layer for background say BG and assign it to the GUITexture.
- Create a new Camera: Menu->GameObject->Create other->Camera
- For Culling mask of new camera assign BG (the layer you have created for the above GUITexture)
- Change depth to -1 for new camera.
- Select Main camera then in Culling mask drop down list unselect BG layer then change depth to 0 and finally change Clear flags to Depth only. That’s it you got a background that fits for all resolution.
- For reference attached a test project package. Good luck.