Universal screen resolutions in Unity for Android

2019-09-11 17:13发布

问题:

I am new to Android development. I sent my app for testing on a couple of devices and a couple were fine, but a couple had the game half way off the screen. In the game scene everything is fine so what could be causing this in some devices?

I am using one main camera set to orthographic and it is a simple 2d game.

I guess one of my mistakes was not using the canvas properly and so I will make improvements, but why would this be like this in the game scene where I cannot use a canvas? Do I have to fix the position of main camera also?

Thankyou for help with this.

回答1:

Try playing around with your canvas' screen match mode. I would try the expand or shrink option. This is pretty self explanatory, it will either shrink or expand your canvas to match the width or the height (depending on your settings for the canvas) of your display. If you're stuck, take a look at the doc for the canvas:

http://docs.unity3d.com/Manual/script-CanvasScaler.html

And the last thing is to play around with your UI elements' anchor positions. Here's the doc for the anchor positions:

http://docs.unity3d.com/Manual/UIBasicLayout.html

Hope this helps!