unitu camera size计算

Camera Size = y / (2 * s)

Where:
y = Screen Height (px)
s = Desired Height of Photoshop Square (px)

 

 

Many game devs will prefer to work with a set size in Photoshop and then adjust their camera setup in Unity accordingly. Depending on the resolution and the target Photoshop size this can require some complicated trial and error. However an untraceable contributor  in the comments section of Rocket 5’s wonderful tutorial series on 2D in Unity , provided a formula thus avoiding the trial and error.

Camera Size = x / ((( x / y ) * 2 ) * s )

Where:
x = Screen Width (px)
y = Screen Height (px)
s = Desired Height of Photoshop Square (px)

It’s a formula that works perfectly and I have setup a calculator to make the calculation process even easier via my Pixel Perfect Camera Size Calculator – Google Doc. Feel free to share, use and download as you wish.

Pixel Perfect Calculator

猜你喜欢

转载自wang-peng1.iteye.com/blog/2302579
今日推荐