2
I made a test game for gadgets with Android.
However when testing on a device, the game was all distorted, squeezed on the screen.
On the computer, when testing the game I made a screen width print and returned 1440 which is exactly the width of the device I am testing, a Samsung Note 4.
I know that this 1440 on mobile is not the same for pc, there are differences in density, but do not know how to solve this problem.
How the camera works in Unity3d and how it solves the problem for different resolutions/densities?
UPDATING:
See an image of how the game looks by Unity simulator:
And another image of how it looks on an android device after building and run:
I did not change the camera, which is with the following values:
If it got squeezed into the screen, it has to do with the reason for its appearance (Aspect ratio) camera. You are changing the value of
Camera.aspect
? Some screenshots (both desktop and mobile) may be useful in the question.– Luiz Vieira
Tip: http://gamedesigntheory.blogspot.ie/2010/09/controlling-aspect-ratio-in-unity.html
– Luiz Vieira
@Luizvieira changed the question and added the images of how it looks on each screen. Thank you.
– Filipe Moraes
And how is this image of the castle being displayed? Is it a GUI object, a texture plane, or what? Image rotates on mobile (when you place the device horizontally)?
– Luiz Vieira
@Luizvieira the image is a Sprite with rigidbody2D and box collider2D. The image does not rotate on the phone because I configured the game to run in Portrait.
– Filipe Moraes
Did you build and install apk on an android device, or are you using Unity Remote? This second image is very common when using the Unity remote, but it is usually best to use it to test device input. If not, remove this image, and tend to use one of Unity’s tools to add a 3d, or even 2D, but do not import images. Just to see if this only happens with imported things, I know that for iPhone he usually converts the image and spoils it. And lastly, your project settings:
edit>project settings > player
besides the player has others, but there is where– Nils
..has the build settings. Sorry I can not help beyond, I’m upgrading to windows 10, and it’s taking a lot to leave the way I like.
– Nils
@Nils I’m building and running directly for an android device, I’m not using Unity Remote. The image is an Sprite that I added to the Assets and then dragged to the Unity desktop and added a rigidbody2D and boxcolider2D.
– Filipe Moraes
Okay, did you manage to add an item from Unity itself to see how it looks?
aspect-ratio
? Or maybe mark theMaximize on Play
Do not forget that it can also be the image import standard. But I need you to perform the tests I passed so I can filter what it is.– Nils
@Nils So I opened the player Settings but there was nothing related to "Aspect-ratio" or "maximize on play". I’m using the latest version of Unity. Regarding the test, you say to add an item of Unity itself, IE, add a square and see if it gets distorted on the mobile? I’m new to Unity, I’m still seeing some concepts.
– Filipe Moraes
On android want to see the device high or side ?? Put preview mode for Andoid too ? and Build Settings set the way you wanted to visualize what you created ? .
– Miguel Soeiro