- Home /
Scale camera to fit screen size
I am programming a game in unity using 2D and C#
The problem is how do I make it so that my game will be supported on all iOS devices? The camera cuts off some of the scene depending on the iOS device, how do I code it so it does not cut anything off. I also can't seem to clamp my player to the screen, the player keeps running out of the screen. How do I do this since the player position is not given in screen coordinates.
It is unclear what the right solution is for your game. If you don't care if your objects get stretched or squished, you can change the projection matrix for the camera:
http://answers.unity3d.com/questions/635701/screen-resolution-scaling-no-solution.html
Answer by Kilroymyboy · Mar 11, 2014 at 03:28 AM
Im just learning myself, but so far i made a simple pong that works on any resolution.
pretty much i used Screen.height and Screen.width to grab the screen's resolution in pixles but keep in mind unity is measured in units.
to convert them i used this method based of the Camera class
screenToWorldPoint (new Vector3 (0f, Screen.height*2f, 0f)).y);
im really sorry i couldn't help more. I have no clue how screenToWorldPoint works. i just followed the unity documents.
Ok awesome! Which unity documents did you follow? Do they have a pong guide that you used?
yeah ill send u a link of a guide i followed,
https://www.youtube.com/watch?v=rlL$$anonymous$$wNI53Oo
if u go to time 17:25 u will see the example im talking about.
sorry for late reply. new to this website
Its ok I am also new. Thanks for the link! I tried giving your answer a thumb up but it won't let me.
thanks anyways. hope it helps. Just a note he does program in Javascript. I use C#