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
4
Question by drhenry · Apr 28, 2010 at 12:05 PM · resolutionnative

How to get native screen resolution

Hi,

is it possible to get the native resolution of the screen?

And is it possible to get the resolution of a certain screen (two monitors of different type, horizontally spanned), lets say the right monitor (Unity game is fullscreen on both monitors)?

At least I need the aspect ratio of the native resolution...

Comment
Add comment
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

4 Replies

· Add your reply
  • Sort: 
avatar image
7

Answer by jonas-echterhoff · Apr 28, 2010 at 11:22 PM

CRT multiscan displays don't really have a "native" resolution, so this question does not really Apply there.

For LCD screens, as Duck said, typically the highest resolution the screen is capable of is the native resolution. You can get a list of supported resolutions using Screen.resolutions, however, this is not always guaranteed to actually contain the highest available resolution, if the user has set his desktop resolution to something less then the highest possible.

This has mostly historic reasons - in the days of VGA monitors, often the graphics cards would support higher resolutions then the screens, and sometimes the communication between the two, to find out which combinations are supported by both did not quite work correctly. For this reason, we would not actually list resolutions higher then the current selected desktop resolution, to avoid switching a system into a screen mode it does not support. I am not sure if this is the case on all platforms, though, and in general, the highest Resolution reported by Screens.resolutions is the closest you will get to getting a screen's "native" resolution.

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

Answer by cncguy · Aug 01, 2010 at 01:50 AM

If you want the resolution the screen is currently set to, you can get that with:

Screen.currentResolution

ie.

Screen.SetResolution (Screen.currentResolution.width, Screen.currentResolution.height, true);

Will set the view to fullscreen at without changing the resolution of you screen.

Comment
Add comment · Show 2 · 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
avatar image Content1of_akind · Jun 12, 2019 at 04:54 AM 0
Share

It's a start, much appreciated. =)

avatar image BlinksTale · Aug 24, 2021 at 06:03 AM 0
Share

I cannot believe this actually works for multiple monitors correctly. I tested it on a three monitor setup, grabbing currentResolution just before switching to fullscreen (per the advice of user "Fattie" in the other answer below) and each time it successfully got the highest possible resolution at the most screen/display filling aspect ratio. Thank you cncguy, this was a lifesaver!

avatar image
1

Answer by Fattie · Jan 07, 2021 at 02:51 PM

Screen.currentResolution ONLY gives the desktop resolution if you are in WINDOWS mode. it DOES NOT give the desktop resolution if you are in FULLSCREEN mode. Ridiculous but true.

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

Answer by duck · Apr 28, 2010 at 04:40 PM

You can get the list of supported resolutions using Screen.resolutions.

I have a feeling that the highest supported resolution is very likely to be the native resolution if the screen is an LCD, however I'm not 100% sure of that.

I'm also not sure what that list will look like in the case of a multi-monitor set up.

Comment
Add comment · Show 2 · 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
avatar image QFSW · Jan 16, 2016 at 07:32 PM 0
Share

In the case when someone is using DSR (Dynamic super resolution), is this still the case?

avatar image julian-moschuering · May 11, 2017 at 11:05 AM 0
Share

Important - Screen.resolutions does report invalid resolutions bigger than the desktop on some machines. Eg. we have machines reporting 4k when the display is actually full hd. Using this resolution in Screen.SetResolution results in a currentResolution of full HD not 4k. I will report this. - From the latter it follows that the highest resolution in Screen.resolutions is NOT necessarily the native resolution.

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

6 People are following this question.

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

Related Questions

Taking the user's screen resolution before running a GUI.matrix? 0 Answers

Fixing the camera's left side in a 2D Game in all screen resolutions 0 Answers

iOS target resolution does nothing? 0 Answers

ScreenToWorldPoint not working properly on deployment 0 Answers

Minimum resolution fix? [Solved] 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