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?
Related
When I switch focus to my React Native app, the window scale (found with Dimensions.get('window')) and PixelRatio sometimes change. The screen scale remains the same.
This messes up the layout of my app big time. Everything is twice as big or small. When not everything is rerendered I see a mix of different PixelRatios.
How can I solve this problem? How can the window scale be different from the screen scale in the first place and is there a way to prevent this?
Only thing in the documentation I could find about screen vs. window is the usable area.
Any help is appreciated, because I don't know where to look anymore.
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.
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.
I am currently working with Unity on a litle platformer for Android. However, I have noticed, that the canvas is just slightly off on my phone than it is in the preview from the unity editor. Here is the difference:
The upper picture is the unity editor, the lower one is from my Samsung S8.
Now, it is clearly not about the black bars. I told the canvas to always render in a 16:9 ratio, so that is fine. However, if you notice the cross, it is just slightly closer to the bottom of the screen. Also to the left of the ground on my phone, you see a little blue line where the background peeks through. Again in the upper picture, this isnt the case. I know it is "just a few pixels" however I am wondering over what I am doing wrong.
I set the canvas to "Scale with screensize" So what could be the issue here?
Thanks for the help!
This is the Dpad: It is an image on the canvas. it works with buttons that are invisible but on top of the dpad.
Samsung S8 native resolution is 2960x1440, so not 16:9? If we control the screen by width, 1440/9*16 = 2560, that would explain the black bar on the side? (2960-2560)/2 each side
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.