Set up camera for 2D games for android

Asked

Viewed 700 times

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: inserir a descrição da imagem aqui

And another image of how it looks on an android device after building and run: inserir a descrição da imagem aqui

I did not change the camera, which is with the following values: inserir a descrição da imagem aqui

  • 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.

  • Tip: http://gamedesigntheory.blogspot.ie/2010/09/controlling-aspect-ratio-in-unity.html

  • 1

    @Luizvieira changed the question and added the images of how it looks on each screen. Thank you.

  • 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)?

  • @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.

  • 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

  • ..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 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.

  • Okay, did you manage to add an item from Unity itself to see how it looks? aspect-ratio? Or maybe mark the Maximize 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 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.

  • 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 ? .

Show 6 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.