Skip to main content
11 votes
Accepted

How to force keep the aspect ratio and specific resolution without stretching the output screen view?

For desktop games you can control the supported aspect ratios directly in Edit -> Project Settings -> Player -> Resolution and Presentation But for ...
DMGregory's user avatar
  • 135k
4 votes
Accepted

How to detect if a mobile device is a foldable phone?

Searching for "samsung foldable phone api" brings up the Android developer documentation on foldables which links to the information on making your app fold aware: To make your app fold ...
Pikalek's user avatar
  • 12.4k
4 votes
Accepted

How to adjust objects' coordinates and scale for different device resolutions?

This depends on how you've authored the objects. 3D objects and 2D sprites positioned in your scene's worldspace will not move, scale or change their worldspace transformations no matter what happens ...
DMGregory's user avatar
  • 135k
3 votes
Accepted

How can I get Unity to do letterbox/pillarbox to maintain aspect ratio?

First, attach a Canvas Scaler component to the GameObject with your Canvas on it. Set it to <...
Almo's user avatar
  • 6,678
3 votes
Accepted

Should I fully draw inside the canvas (e.g.: 32x32 aspect ratio) for pixel art games?

This is a stylistic decision you'll need to make, based on your game's gameplay needs and your own creative goals. A few considerations you can weigh in favour of using the full canvas: It allows ...
2 votes
Accepted

Android Specifications : What are the integer values for "small" screen size, "normal" screen size, ldpi, mdpi, hdpi?

Dropping android:screenDensity="ldpi" into the site search at the official Android development site gives the screen densities reference as the second hit ...
Pikalek's user avatar
  • 12.4k
2 votes
Accepted

If I want to create game for mobile and tablet on android and ios, which aspect ratio or screen resolution should I use?

These are all of the aspect ratios you have to handle: 4:3 3:2 8:5 5:3 16:9 Source: https://stackoverflow.com/questions/7199492/what-are-the-aspect-ratios-for-all-android-phone-and-tablet-devices ...
Jacob's user avatar
  • 2,552
2 votes
Accepted

Unity - how to switch between ratios in a Scene View?

As Uri Popov notes in the comment above, this is done via the Game window rather than the Scene window itself. Just beside the display selector at the top of the Game window, you'll see a drop-down ...
DMGregory's user avatar
  • 135k
2 votes
Accepted

The rightmost part of the game screen is truncated in HTML

Your WebGL export is using a different aspect ratio than the one you're using in your editor. The WebGL viewport is 960x600, an 8:5 aspect ratio, where the width is 1.6 times the height. Your editor ...
DMGregory's user avatar
  • 135k
2 votes
Accepted

Will putting Screen.orientation in Update affect the performance?

As Philipp says in a comment above, the best answer to every question of the form "how does X affect performance?" is: Profile your game and find out. Unity has some great profiling tools ...
DMGregory's user avatar
  • 135k
1 vote

Keep aspect ratio on window resize in Unity

In this stackoverflow post and this gamedev stackexchange post the advised solution is to constantly use Screen.SetResolution() in the Update() method. This solution however seems very resource ...
Arian_ki's user avatar
  • 691
1 vote
Accepted

How to stop Sprites from stretching on Mobile with different aspect ratio

I had a wrong understanding of how Unity Remote 5 works. When running the game in the editor Unity will use (as usual) the resolution/aspect ratio set in the Game panel of the editor then just mirror ...
KarlTheGreat's user avatar
1 vote
Accepted

Unity difficulty placing text within the reference resolution of the canvas

Ah, the joy of creating resolution-responsive screen layouts in Unity. If I understand you correctly, your goal is to create an UI which always preserves its aspect ratio, but also fills as much of ...
Philipp's user avatar
  • 120k
1 vote

Understanding Unity-UI Layout Element - Mininum and Preferred Size

I don't believe this can be accomplished with the ContentSizeFitter and LayoutElement components. Instead, you will need a ...
Acme Nerd Games's user avatar
1 vote

How to adjust objects' coordinates and scale for different device resolutions?

It will adjust everything automatically for different resolutions if the aspect ratio is the same. If the aspect ratio is different, everything will still be scaled automatically, but you might see a ...
sonnyb's user avatar
  • 596
1 vote
Accepted

3D camera - window resolution relation

don't mind the different aspect ratios But that's the problem. If you use 2 windows with different sizes but the same aspect ratio you won't see this problem. It looks like you're using the Field of ...
user1118321's user avatar
  • 2,632
1 vote

Scale VBO magnitudes based on aspect ratio

You need to recalculate your projection matrix whenever the screen aspect ratio changes. 1/100th of the screen width and height is still exactly 1/100th of the screen width and height when the ...
Stephane Hockenhull's user avatar
1 vote

Quality deterioration on a device

The render quality settings apply mostly to 3d games. Very few of the features you would usually use in a 2d game are affected by them. It seems like your play-window uses a different resolution than ...
Philipp's user avatar
  • 120k
1 vote
Accepted

Make virtual joystick preserve aspect ratio Android in Unity

If you want to specify game orientation, go to File -> Build Settings -> Player Settings and there open a tab ...
Jacob's user avatar
  • 2,552
1 vote
Accepted

Unity2D - Horizontal Scaling to Support Various Aspect Ratios?

Okay, so I think I've got this worked out, so I'm making my own reply. I attached this script to the main camera. ...
Infergnome's user avatar
1 vote

How do you handle aspect ratio differences with Unity 2D?

This is an >5 years old question, but it's still not only quite relevant, but also getting more and more complex over the years as there are even more screen ratios on mobile devices nowadays than ...
user3345048's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible