I can't build apk to it supported 18.5:9 aspect ratio. Now it shows black lines at top and bottom:
The camera is cleared by a white color so black lines are not a problem of the canvas settings or some other game object.
Also I set PlayerSettings -> Aspect ratio mode to Native aspect ratio and checked the Start in fullscreen mode flag.
P.S. I use Unity 2018.3.11f1.
ADDED
It's not a problem of UI elements on Canvas because of the splash and all scenes is shown with black gaps. Also before I hadn't it, this bug happened when I've updated from Unity 2018.3.10f1 to Unity 2018.3.11f1 and added this loader scene to select language, maybe I changed yet something I don't know because of I found this bag much later when I tested the game on 18.5:9 device.
P.P.S. If it's important I use Android build-tools 29.0.0-rc2, Android NDK r16b and set Android Pie as target platform.
Related
I have few scenes in my project. I was able to center all of the other scenes. But i cannot center the main scene in my project. Its fine when it opened on a mobile device(probably because resolution matches i guess). but when i opened it in tablet(its an old tab "xiaomi tab 3") its always align to the right on the screen. I was able to center other scenes but i cant center the main scene to screen for some reason. project setting set as 2D and Expand. I also tried to use Control nod, canves layers, margine containers.. but nothing works. If someone can give any suggestions, Thank you in advance.
img1
https://i.stack.imgur.com/FJOHl.jpg
project
1920 x 1080
I have seen this problem, or similar, in windowed mode. I don't know if this is the exact case, but if it doesn't mess with your project, try full-screen mode.
If it's that, you can also take care of the window bar size (which is a problem because it can change from different devices), since godot will count its pixels too.
Notice that you're only having this problem in one axis.
Also, I think you could take a look into the Viewport Stretch Mode. It could mess your graphics depending of the intended result—but other projects won't even notice, so judge for yourself.
The viewport setting sets the root scene’s Viewport to the base resolution. The rendered output of the root Viewport is then scaled to the display resolution. [...]
The viewport setting is a better choice than the 2d setting when pixel-perfect precision is required, since primary rendering still occurs at the base resolution.
Support multiple devices
Scaling correctly for all devices could be an odyssey, so bon voyage.
If anyone can help me with this issue that i am having after creating a gaming app in unity.
Actually everything went well, except the aspect ratio of the mobile.
I had chosen the aspect ratio to to be 720x1280 and now it runs on that screen size only. If I try to run it on different screen size, it just does not, it gets stretched and nothing displays as developed. I have been searching for this for weeks. I also tried to change the aspect ratio of the game in unity editor only but whole things gets disrupt, so I can't undo the coding also, it'll take a lot of time again.
Please if anyone can help me, I'm all ears.
Follow Designing UI for Multiple Resolutions. But if you have already adjusted the canvas and all its objects for different resolutions, Controlling Aspect Ratio in Unity might help you.
I think you have a problem with using canvas elements, they all have RectTransform components by default(instead of Transform). All game object with RectTransform has it's anchor and pivot and only thing you have to do is construct them properly.
You can watch this tutorial(or find other videos too on same topic) and it will help you
https://www.youtube.com/watch?v=Ad-Q9hYCnCg
Select Canvas , and in the inspector go to Canvas Scaler -> UI Scale Mode and select Scale With Screen Size
Hello in my unity project i have made 2 levels but when i build and run them on android they always scale upwards or downwards either the buttons were way too big or the main menu icon was really small.. i was wondering if there is any way change the scale or configure the look from the editor. Any help is appreciated.Here are some screenshots. http://kharief.imgur.com/all/ ( i want the paper to be the background and scale down the buttons)
You can change the way the Canvas scales in the inspector. You can either have the pixels set to a constant size, scale with the screen size, or maintain a constant physical size.
I have searched both Stack Overflow, and Unity Answers, but I can't find any information on this problem. I have asked a question on unity answers, still awaiting response.
The problem I have is when I build to either Android, or Web, (haven't tried others), there is a black bar on the right of the screen. On android, it is a duplication, 4 times, of a strip of the screen. about 20px wide, and 1/4 of the screen height, quadrupled up the right side of the screen. When I move objects through the area of the screen being copied, it is animated in the side bar.
on the Web build it is just black, but should be blue background.
My game is 2D, using orthographic camera.
Please help! I have no idea how to even properly search this kind of problem.
I just did a Web player build in a new test project, and it was fine, so it must be some setting in my game project,
Thanks in advance
Edit.
I also did a build in android with a new test project no problems. Then I created a new project, and copied my game assets and other folders into the project directory. Then the silly glitch happened again. I am at a loss here. Any ideas?
Edit * [Solved] Thank you to Josh, the problem was solved!!!! What was going on was on my mainCamera, the Viewport Rect setting were of. I had the settings as
X=0, Y=0, W=0.975, H=1.
So a bit of the width of the screen was being clipped.
I set the settings to the default,
X=0, Y=0, W=1, H=1.
And it worked!!!!
this is a picture of the glitch on my HTC One V Android
This is the glitch on Chrome Web player, no screen copying, just black, where the background should be blue
Have a look at you camera. The first property is 'Clear Flags'. If that is set to 'Don't Clear' whatever was last drawn in any area of the screen will remain in the next frame.
Try setting it to 'Solid Color', or 'Skybox' and set the Skybox Material parameter in Edit -> Render Settings.
Also, check your camera's 'Viewport Rect' and ensure that it's parameters cover your screen. The default values do this; X=0, Y=0, W=1, H=1.
The aspect ratio of your the window your game is being run within will affect the ratio of your camera's bounds. It's not always the same as the editor window within Unity. You can lock the editor window to a specific resolution or aspect ratio by selecting to dropdown box in the top left of you 'Game' tab within Unity.
Beyond this it's hard to tell what's causing the issue without more information. Are you doing something funky with shaders, multiple cameras or rendering paths?
I'm developing a game, and in Unity I've set the resolution to 1280x800.
When I export to Android, I expect it to adjust to the screen (adding black bars if necessary) but it isn't the case.
This is how it looks like on a Nexus 4:
And on a Nexus 5:
How can I make it so that it looks the same everywhere? (having black bars if necessary as I said before).
You need to normalize the camera's orthogonal size to a wanted resolution:
camera.orthographicSize = 640/screenwidth * screenheight/2
More info here