Unity Viewport size to Full HD? - unity3d

at the moment I start with Unity in 2D development for android. Before I develop in Unity i develop with LibGDX where I can the Viewport to a static screen resolution at 1080 * 1920, if the game starts on a smaller device for example 480 * 800 the game still looks pretty good. In Unity when I use a Orthographics Camera and set the width to 1080 and the height to 1920 it looks like a equal long quadrate and not portrait.
How can I use a static Camera which the Viewport is 1080 * 1920 and for other devices unity self charge the resolution for the game?
Sorry for my bad english :(
greetings coco07!

You can't. You're thinking about 2D engines. Unity is a 3D engine with a 2D extension (sort of). You set your camera up (doesn't matter what orthographic size you use), and it gets scaled to the viewport of the device it's running on. the size you set is the size of the viewport, in world units, along the y axis of the device's display. The width is set automatically based on the device's aspect ratio. You can see this by resizing the game window in unity. Doing that causes the visualization of the camera's bounds to change. To create a static camera, you'd have to manually add black borders around the edges (or at least I think you do), OR, better yet, create your game in a manner that runs on all aspects. You should consider aspect ratios between 4:3 and 16:9 for landscape and 3:4 to 9:16 for portrait games. This is specially important since many recent devices use on-screen system buttons (such as the google nexus and Xperia Z series) which means you get an aspect ratio of a little bit less that 16:9 (or a bit more, on tablets). This doesn't sound like much, but if you down-scale a 16:9 image to fit on those devices' screens, it looks ugly as hell.

Related

Unity on mobile cuts off sides (not canvas related), on different resolutions

I'm developing a 3d game on unity and using the 1080x1920 portrait resolution.
When I build and run the project on my phone, which has a 1080x2340 resolution in portrait, it cuts off part of the game (the sides).
red lines indicating where it cuts off
The camera doesn't follow, so the player can "go out of the screen".
How can I fix this, making sure my game looks the same on different resolutions?
(edited to correct resolution order)
Does your play area have a fixed size? If the in-game play area's aspect ratio isn't the same as the device running the game, you'll have to either cut off part of it or include blank space at the top/bottom or left/right. Unity's camera orthographic size dictates how tall the camera view is, but not how wide. The width is just screenAspectRatio * camera orthographic size.
To fix this:
float aspect = Screen.Width / Screen.Height;
myCamera.orthographicSize = Mathf.Max(playAreaHeight, playAreaWidth / aspect);
This will cause the camera's view to be either too wide or too tall rather than too small.

How do I make Pixel Perfect Camera scale like Normal Camera in Unity 2D

This is my scene
Right now if I use resolutions that aren't 16:9 the Pixel Perfect Camera zooms out quite a lot showing parts that shouldn't be shown.
How do I get it to scale like the Normal Camera which just cuts out parts outside the borders?
The Reference Resolution is currently set to 320x180, I tried changing the Reference Resolution to other resolutions (640x360, etc) but that changed nothing.
Tried Pixel Snapping on/off.
Cropping the X and Y does a good job at hiding the outside borders places but makes the screen too small for non 16:9 resolutions.

Unity game scene is not in full screen on mobile

I'am having problem making my app be full screen on all device. on my device, w/c is a low end Jelly bean phone doesn't give me the right resolution I want.
Here is my desired output:
this is still in editor, resolution 1080px by 1920px in Portrait mode
here is the output on my device:
as you can see, you can see a blue part on the screen.
Thanks in advance.
It looks like your background is visible from behind your geometry, the aspect ratio of two screenshot is different. It looks like you designed the game in a 278x490 resolution (aspect 1:1.762) and displaying it in a 480x800 resolution (aspect ratio 1:1.666).
You should always design for the lowest possible aspect ratio, then you don't have this problem.
You have two solutions:
You should add some walls/roofs to make margins that will be visible on wider devices
You can shorten the length of the corridor by scaling the game field up so the width fits.

Unity3D 2D game. Fit camera horizontally

I'm working on Unity3D 2D mobile game and I've got a problem connected with aspect ratio. When changing aspect ratio the camera always fits vertically. For landscape mode games it is a good practice. For portrait mode games it is better to fit camera horizontally. So My game needs to fit camera horizontally. Please help me with it.
Let's say your aspect ratio is 4:3
If you want to make your camera fit landscape mode of 16 units wide, you would make your camera a size of 16 / 4 * 4
If you want to make your camera fit portrait mode of 16 units tall, you would make your camera a size of 16 / 3 * 4

Pixelation issues on iPhone Air game

I am working on a cross-platform mobile game for Android and iOS devices. I am using Adobe Flash with AIR and AS3 to code the game. I am drawing my character, obstacles, and backgrounds in Adobe Illustrator. The canvas in Flash is set to 960x640. The character was intended to be 1/3 of the screen height so around 213 pixels high. I designed the character in Adobe Illustrator to be somewhere around 900 pixels high. When I imported the character into Flash I animated him, instantiated him using var player:Player = new Player(), and scaled him down to size using the scaleX and scaleY properties. I tested it out on the desktop and Android phone and it looked wonderful. However, when I tested it out on an iPhone, the player was unacceptably pixelated around the edges. I figured the fact that I drew the animation much larger than the intended height must be the problem, so I redrew the player to exactly 213 pixels high and retested on the iPhone without any improvement in the quality of the animation. I also tried converting the MovieClip to a Bitmap vector explained here but that also had no effect on the quality of the animation.
At this point, I am at a loss. Does anyone have any suggestions on how to avoid this pixelation issue that I am experiencing when going from Adobe Illustrator to Flash to the iPhone?
For a more optimised iPhone route you might want to consider creating your animation as a set of bitmap graphics, i.e. create them as png files using PhotoShop at the size you want them to be displayed at.
By doing this you'll save CPU activity in having Flash create smoothed bitmaps
Try to set smoothing to true for your bitmap.
yourbitmap.smoothing = true;
I have some solutions for your problems.
Character should not have dark outlines. Use gradients for better effects.
Color combination should understand for your character. which background you use and other things.