Screen cropped issue in unity 2-D game

后端 未结 2 983
自闭症患者
自闭症患者 2020-12-20 00:48

I developed one 2-D game in unity. First I have run game on web player my screen is cutting from both ends. Now I am creating android apk from it. Then on android devices it

2条回答
  •  执念已碎
    2020-12-20 01:20

    Since you are making a 2D game, I presume you are using the orthogonal camera. Unlike perspective camera, the orthogonal camera shows more stuff on the screen the bigger resolution you have.

    You need to normalize the orthogonal size to a wanted resolution:

     camera.orthographicSize = 640/screenwidth * screenheight/2
    

    In the above code the orthogonal size is normalized to 640 pixel width. (Link)

提交回复
热议问题