- Home /
Same camera view on different resolutions
How can I keep the playfield that I have created the same size on different resolutions? I am using the orthographic camera, and the problem is, depending on the resolution some objects get cut off. See the pictures below:
Resolution: 800x480
Resolution: 480x320
Did you set the orthographic size of your camera according to your resolution ?
camera.orthographicSize = Screen.height / 2;
EDIT : $$anonymous$$y bad you seems to have a ratio problem. How do you place your objects ? You need to place them in function of your resolution.
For example, if you want to place an object on the right border you can do a trick like this
myObject.transform.localposition = new Vector3(Screen.width * 0.5f - widthObject, 0, 0);
This question has been asked so many times... and usually the biggest problem is the asker doeasn't know what he wants. Theres no way to make a square peg fit a round hole, so you have to compromise.
It's easy to convert screen coordinates to world coordinates and back. Then it's just a question of where on the screen do you want the ui to be placed on different screens.