Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by marekdur172839 · Jan 05, 2019 at 01:20 PM · resolutionheightwidthratio

Keep screen width instead of height for resolutions

Hello I am new to Unity, but so far I ve managed to google solutions to my problems until this one.

When changing resolution in 2D project or let say aspect ratio, unity will keep my screen height and scale my width.

But I want it vice versa Here are some images:

alt text

alt text

At the sedond image,there is cropped a part of path in grey area HoW do I make it to cropp from top of the screen and keep the same width"? THanks

fullhd.png (35.2 kB)
xiaomi-mi8-res.png (31.0 kB)
Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image troien · Jan 06, 2019 at 12:37 PM 0
Share

I don't post this as an answer, because I havent tested it very well, but I think this might push you in the right direction.

You'll want to change the camera's orthographicSize). You want it to have a value like 5 (can be anything you want) for instance on your target aspect ratio (height/width of screen)

As an easy example, you have everything set up for a resolution of 300x300 (aspect ratio of 1 as this makes further calculations simpler) on which you use 5 as orthographic size.

And you want to display it on 300x600 (aspect ratio of 0.5)

You should set your camera's orthographicSize to: 5 / aspect. So in case of 300x600 this would be (5 / 0.5 = 10)

Now if your original target aspect is not 1, you'll have to offset the aspect so that your target aspect is inserted as 1 in above calculations. But as I said, havent tested this enough to give you the exact maths ;)

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by RadonRaph · Jan 06, 2019 at 01:18 PM

The result in game's window and in the build its not the same, try to build to see if the problem persist. Also you can look at: https://docs.unity3d.com/ScriptReference/Screen.SetResolution.html https://docs.unity3d.com/ScriptReference/Screen-height.html https://docs.unity3d.com/ScriptReference/Screen-width.html

Good day, Raph

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

99 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Game fills only one quarter of the screen, why? (Android) 1 Answer

Is it better to enlarge an image by width/height or by scale? 0 Answers

Screen width and height, how to bypass?! 1 Answer

How can I make the game Screen to fit resolution 2 Answers

Object resolution 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges