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 stefanpopescu99 · Feb 17, 2019 at 04:05 PM · buildresolutionbuild settingsresolution settings

Why don't I get the right resolution after I build the game in my in-built settings menu but inside Editor everything is fine?

When I actually try the game inside Unity everything is fine. When I build the game and try it every resolution is shown twice and they are reversed(ex: 1920 x 1080 is 320 x 200, 1680 x 1050 is 320 x 240 and so on). I will give you my code here:

 public Dropdown resolutiondropdown;
     Resolution[] resolutions;
     void Start()
     {
         resolutions = Screen.resolutions;
         resolutiondropdown.ClearOptions();
         int currentresolutionindex = 0;
         List<string> options = new List<string>();
         for(int i=resolutions.Length-1;i>=0;i--)
         {
             string option = resolutions[i].width + " x " + resolutions[i].height;
             options.Add(option);
             if (resolutions[i].width == Screen.width && resolutions[i].height == Screen.height)
                 currentresolutionindex = i;
         }
         resolutiondropdown.AddOptions(options);
         resolutiondropdown.value = currentresolutionindex;
         resolutiondropdown.RefreshShownValue();
     }
     public void SetResolution(int resolutionindex)
     {
         Resolution resolution = resolutions[resolutionindex];
         Screen.SetResolution(resolution.width, resolution.height, Screen.fullScreen);
     }

And a screenshot I took: alt text

unity-problem.png (59.8 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 stefanpopescu99 · Feb 18, 2019 at 06:03 AM 0
Share

No one in the entire unity community knows the answer?

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by JedBeryll · Feb 18, 2019 at 07:53 AM

The resolutions also have a refresh rate so may get something like 1920x1080-50Hz and 1920x1080-60Hz, that's why you have 2 or more of the same resolution. As for why the array is reversed, i have no idea.

Comment
Add comment · Show 1 · 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 JedBeryll · Feb 18, 2019 at 08:02 AM 0
Share

Putting the smallest resolutions first:

 resolutions = Screen.resolutions;
 resolutions = resolutions.OrderBy(res => res.width).ToArray();

Putting the largest resolutions first:

 resolutions = Screen.resolutions;
 resolutions = resolutions.OrderByDescending(res => res.width).ToArray();

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

108 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

Related Questions

Camera Changes Proportions In Build 1 Answer

Resolution Not Saving On Build 2 Answers

Can I make games for higher res ? 0 Answers

Distribute terrain in zones 3 Answers

Player Settings Standalone resolution will not change? 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