How can I change the screen size in Unity? - unity3d

Currently I am working on a Unity project. I started it on version 2018.3.6f1. The other day I installed version 2019.3.0a2 and this changed the screen size so now I have a white background at each side.
If I try going back to the size I had using the scale tool, it does not work so what do you recommend to change my screen size correctly or change it to its original one?
Here is a representation of my problem:
https://imgur.com/a/QKl9kVr

This is related to a setting you can change from the top bar of the Game window, it effectively sets the screen size emulation within the editor to different values, it looks like you want to have 'Free' mode, but you can also check behaviours in any other resolution

Related

How do i fix the layout problem in unity?

Im trying to build a replica of the game 'Breakout'.
when i build and run the game in unity it looks good and everything id the correct scale but when i build and run the project on my laptop all the elements change size and some of the elements dont change size and i am not sure if i have done anything wrong or if i have forgotten to do something to stop it from changing.
This is what the game looks like in the unity editor when playing the game:
And this is what it looks like once i build and run the project on my computer:
My resolution is set to stand alone.
is there a way to get it to look like it does in the unity editor when i build and run it on my computer because that is what its supposed to look like.
These days, there are many different screen sizes, and resolutions.
My favorite solution is to use a reference resolution that can expand but never shrink. This allows you to have a safe zone that stays consistent across different screen sizes. For a generic case, you would use 16:9 aspect ratio, with the resolution of either 1280x720 or 1920x1080.
In Unity, on your canvas, modify the Canvas Scaler such that UI Scale Mode is set to Scale with Screen Size. Add your reference resolution, and set the Screen Match Mode to Expand.
In the Game tab you can preview what 16:9 looks like. You can try out other aspect ratios or resolutions.
For example, the iPhone 11 has a much wider resolution, so it expands horizontally. It's up to you to design your UI in a way that makes sense. You can either keep everything in the safe zone or align elements to the corners of the screen.

Unity: text is clear in editor but blurry in game

I've read that Unity has problems rendering clear text and I've tried out several different fixes: setting a large font size on the imported font and changing the character setting to unicode, making the text size large and then scaling it down, setting filter mode to point when it comes to pixel fonts... All these methods seem to work from the editor (as in, the text appears crisp), but in the game the text is still blurry:
vs.
(The screenshot is using free aspect - the text looks better, but still somewhat blurry, when the game view resolution matches the reference resolution.)
Currently, the imported font (not pixel) is set to a size of 180; rendering to smooth; character to unicode. The text isn't scaled right now and is at a size of 50. The canvas is set to scale with screen size, and the reference resolution is 2560x1440 (a Samsung S7). It should also be noted that at a different resolution, the box around the text (which is an image) also gets blurry, which makes me think it's a problem with the canvas scaling.
What am I missing?
Turns out all I had to do was uncheck Low Resolution Aspect Ratios in the game view... The text is still slightly blurry, but likely that's typical of Unity. To counter that, I just decided to use a pixel font (using the fix explained in this video).
I use scaling down as a workaround.
For me, it was using Unity-Remote. After building the app directly I didn't see the blur anymore.
I had the same problem, the best solution to the blurry text problem in Unity is as follows:
Select the text item from the scene.
Go to Font and see where your font is located in your project folder
Go to your font in your project
Change the font size from 16 to 100-300
change "Character" to "Unicode"
Press Apply

Zooming doesn't work in Unity although FOV changes

I am working on a 2D project and I want to zoom in my map by scrollwheel. I am sure that my code is working (because during the play mode, field of view changes when scrollwheel is rotated) but no change on the screen is observed.
Besides, during play mode even if I change the field of view manually (from the editor), the screen view remains same. That is, although field of view is observed to be seen changing but the screen view is not.
What are the possible reasons for that?
Here is the screenshot of the editor attached:
Possibly because you're using screen space canvas. Put the canvas in the world space for field of view to have any effect.

Resolution issue when building the game

I am using the ViewportHandler script for Unity(https://github.com/dfsp-spirit/way2close/blob/master/Way2Close/Assets/Scripts/ViewportHandler.cs), to allow for my UI to appear the same in different resolutions. I am pretty sure that it was looking just fine and pretty much the same in all resolutions(with different quality graphics due to stretching, but that is fine).
I have opened up my project after a while and I am now noticing that while the game scene looks fine inside the editor, the UI elements change position for all resolutions when building the game.
I am attaching two screenshots to show the difference. The Editor one is the proper one where elements are aligned properly. The other one is when I am building the game and running it full screen.
The weird thing is that when building the game, every resolution displays the wrong way (as in picture 1). So the elements are actually resizing properly, but they are just in the wrong place for some reason and I really can't see why. Any ideas ?
(My Canvas is Screen Space - Overlay, Scale with Screen Size, Ref resolution is 2560/1440, Match width and height and ref pixels 100).
You don't need 3rd party scripts to achieve a constant size on different resolutions. Use the Canvas Scaler component on your canvas and set it to 'Constant Physical Size'. Unity should handle all the rest.
If images/sprites change position, try to change the anchor point to fit your needs.

Unity: Strange Camera Offset for multi-monitors at different resolutions

I am creating a game (it's actually more of an application/useful software than a game) which needs to be run on multiple monitors, where all monitors are potentially different resolutions.
In the example below, you can see the primary monitor (far left) rendering a full screen camera view, just as it should. There are two other cameras set to render to monitor 2 and 3. These are activated with Display.displays [1].Activate (1600, 900, 50); (so as to set their resolutions to 1600x900).
The issue is that Unity appears to be offsetting the camera rendering so that it does not originate from the top left of the screen, but rather some way down the window. The grey area shows the area where the image is missing.
When running in the editor, the cameras render each window perfectly with no strange offsetting/cropping.
What do I need to do in order to get the standalone output to render the correct, uncropped/offset image in each of the windows, please?
If I make the resolution of all monitors the same, it renders exactly as it should do:
Annoyingly, this seems to be a bug with Unity version 5.3.x. It seems to be fixed in 5.4.x [See Bug Report Here] (I have downloaded the beta and tested it - I can confirm this to be true!). However, 5.4.x is currently in beta and you can only access it if you have Unity Pro.