Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 leonalchemist · Jun 12, 2019 at 12:47 AM · resolutionscreendisplay

Get correct resolution

After many many tries and months of struggle and nonsense, anyone knowns how to get the current display resolution? Don't understand why it's so difficult :/

I know using Screen.currentResolution.width works for windows mode where I'll get the correct screen resolution even if I move the game window to a different screen, but fails in full screen mode. Anyone knows the answer to this?

Comment
Add comment · Show 4
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 leonalchemist · Jun 13, 2019 at 02:54 AM 0
Share

Looks like this is impossible to my knowledge which is rather weird, many people use a similar workaround for this.

I basically use something like this where I put the game in windowed mode, wait 0.1 seconds, then apply the resolution using Screen.currentResolution as you get the actual desktop resolution regardless of game window size or even if you move it on a different screen mid game:

 Screen.fullScreen = false;
 yield WaitForSecondsRealtime(0.1f);
 var r : Resolution = Screen.currentResolution;
 Screen.SetResolution (r.height/0.75f, r.height, false);
 //Re-apply fullscreen mode if needed
avatar image Capricornum · Jun 13, 2019 at 05:24 AM 0
Share

I don't know how to get to it but the resolution in full-screen is hidden in the Screen.width property.

When you look up Screen.width in the documentation it says: "in full-screen it is also the current resolution". The same is written in the Screen.height documentation. And I recall using Screen.Width / Screen.Height once and the result weirdly was 1, albeit the actual width being 2048p and height 1012p or something. I expected the answer to be 1.6 anyhow. So somewhere hidden in there is the actual resolution.

avatar image leonalchemist Capricornum · Jun 13, 2019 at 02:31 PM 0
Share

Could be wrong but I think Screen.width return something like the store resolution that's automatically save for your game in the registry. So not a very useful variable.

avatar image Capricornum leonalchemist · Jun 13, 2019 at 05:51 PM 0
Share

Ok, sorry. Good luck.

0 Replies

· Add your reply
  • Sort: 

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

109 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Windows: Multi Display with two different resolutions 2 Answers

unity Display.displays[].setParams Problem 1 Answer

Pick sensible resolution for FullScreen Mac App 2 Answers

WebGL build has degraded resolution on zoomed-in browsers or systems 0 Answers

Maximize window mode and alt tab 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