I am making a 3D game on Unity. Currently I work on main menu. The problem is
when I use 16:9 aspect ratio I get this result:
The background is not scaled.
However when I use Free aspect ratio, I get this:
Here is background object properties and sprite properties:
I have no clue what is the problem here and how to solve it. I hope to find some help here. Thanks in advance.
You should extract one tile of the background sprite like this:
Then it should be tiled correctly.
The key is to extract the smallest repeatable element.
Also, you don't have to worry about the Free Aspect. Just make sure it looks fine on the real screen resolutions.
Related
I'm new to Unity and to game development in general.
I would like to make a text-based game.
I'm looking to reproduce the behavior of an instant messenger like messenger or whatapp.
I made the choice to use the Unity UI system for the pre-made components like the rect scroll.
But this choice led me to the following problem:
I have "bubbles" of dialogs, which must be able to grow in width as well as in height with the size of the text. Fig.1
I immediately tried to use VectorGraphics to import .svg with the idea to move runtime the points of my curves of Beziers.
But I did not find how to access these points and edit them runtime.
I then found the "Sprite shapes" but they are not part of the "UI",
so if I went with such a solution, I would have to reimplement
scroll, buttons etc...
I thought of cutting my speech bubble in 7 parts Fig.2 and scaling it according to the text size. But I have the feeling that this is very heavy for not much.
Finally I wonder if a hybrid solution would not be the best, use the
UI for scrolling, get transforms and inject them into Shape sprites
(outside the Canvas).
If it is possible to do 1. and then I would be very grateful for an example.
If not 2. 3. 4. seem feasible, I would like to have your opinion on the most relevant of the 3.
Thanks in advance.
There is a simpler and quite elegant solution to your problem that uses nothing but the sprite itself (or rather the design of the sprite).
Take a look at 9-slicing Sprites from the official unity documentation.
With the Sprite Editor you can create borders around the "core" of your speech bubble. Since these speech bubbles are usually colored in a single color and contain nothing else, the ImageType: Sliced would be the perfect solution for what you have in mind. I've created a small Example Sprite to explain in more detail how to approach this:
The sprite itself is 512 pixels wide and 512 pixels high. Each of the cubes missing from the edges is 8x8 pixels, so the top, bottom, and left borders are 3x8=24 pixels deep. The right side has an extra 16 pixels of space to represent a small "tail" on the bubble (bottom right corner). So, we have 4 borders: top=24, bottom=24, left=24 and right=40 pixels. After importing such a sprite, we just have to set its MeshType to FullRect, click Apply and set the 4 borders using the Sprite Editor (don't forget to Apply them too). The last thing to do is to use the sprite in an Image Component on the Canvas and set the ImageType of this Component to Sliced. Now you can scale/warp the Image as much as you like - the border will always keep its original size without deforming. And since your bubble has a solid "core", the Sliced option will stretch this core unnoticed.
Edit: When scaling the Image you must use its Width and Height instead of the (1,1,1)-based Scale, because the Scale might still distort your Image. Also, here is another screenshot showing the results in different sizes.
This is what the game looks like in the 'game' window in unity, which is what it should look like https://ibb.co/xjst4vw achieved by removing all lighting including ambient lighting.
And this is what it looks once built https://ibb.co/4RcbMv8
Why is there a haze in the border between colors? How do I get it to be pixel perfect?
The aspect ratio of the in editor display is 160x144
I have change the game resolution by going to >edit >project setting >player and changing the height and width to the right size
The camera is also passing to a render texture which is of the right size, with the filter mode set to point.
I cant figure out what is causing this. to my knowledge All lighting is turned off. It looks like some up scaling error or maybe some sort of anti-aliasing effect which has also been turned off everywhere i could find.
Does anyone have an idea about what might be causing this? thanks.
There is postprocessing window in unity where you can specify such things like antyaliasing and so on. I think that this will make your game pixel perfect.
Found the answer to my own question the resolution in the >edit >project setting >player >resolution and presentation need to be as high res as it can be so in my case for a 1920x1080 screen it should 1120,1008 which is 160x144 scaled up by 7.
Then send data from you're main camera to a render texture that is set to the resolution you want (in my case 160x144) and create UI canvas that takes up the whole screen and a raw image as a child. Then put the render texture you created in the texture.
So I created a new project in which I've set my display to be 1440 x 2960. I made a background in PSD with the exact same size, and when I place it in the scene, it appears to be way bigger than the actual camera, which should obviously be the same size. Why is that? I'm quite a newbie and I find this very counter-intuitive.
I think you are mixing up resolution with camera size/field of view.These are Different things things.
And also how big your object is in your scene also depends on : pixels per unit" that uyou set up in your Graphic asset.
In Unity3D I can't scale the game properly to remove the black bar.
I've added pictures for reference:
EDIT: I need to make the canvas scale to the whole screen instead of only a part of the screen.
You should first set your game viewport to simulate the resolution and screen size of whatever you're building for. Change Free Aspect to the appropriate aspect ratio or manually add a new resolution.
Also, I believe the match mode you want for your Canvas Scaler is Match Width or Height.
You have to set anchors of Image to each corner of your canvas display so It can scale accordingly.
Just change the aspect ratio from 'free aspect' to '16:9' or manually enter an aspect ratio that suits your needs.
Cheers.
Try to dynamically spawn the background or image by using Scale To Fit lots of Unity Documentation to help with that so when compiled you can tend to get a stronger and fuller picture this may help with a general sizing issue
Set the screen resolution manually in the Start() of your code:
Screen.SetResolution(x, y, true)
I'm working on a Unity 2D project and making the levels at the moment.
For some reason even really high resolutions (higher than 1920x1080) become really pixelated. It's like the camera is zoomed in too much. My player is rendered at a scale of 0.2x0.2.
I've tried changing the z-depth of camera back but everything still becomes very pixelated. Really frustrating because edges of tiles on the screen become really pixelated.
Anyone had any issue or can think of anything that will help solve this?
here's a picture of it in the editor mode. Based on the tile grid you can see everything's really tiny and it's awfully zoomed in. Not sure how to fix this.
In game:
Noticed how pixelated it is. Thanks
On your first screenshot the sprites are also pixelated.
Every time you see bad image quality - checkout import settings. Try to increase max size. Also try different format. You should find the suitable values for yourself.
I find that when I set the export settings to Android, everything gets pixelated, even skies (I suppose it does that in order to adapt to the device's lower capacity). Turning export settings back to web player for example, solves this issue.