Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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
1
Question by spraycanmansam · Aug 07, 2014 at 04:31 AM · macfullscreenosx

Screen.SetResolution and full screen not behaving correctly

Hi all,

As the title says, I'm having a problem with using Screen.SetResolution(...).

When in fullscreen mode, and calling Screen.SetResolution(1024, 768, false), the game will exit fullscreen mode but the resolution will not be applied and appears to revert to 640x480 (more on that below..). If you then change the resolution again while in the windowed mode, the resolution will change to the appropriate windowed resolution.

I'm disabling the 'Display Resolution Dialog' in the player settings, so that all the resolution settings are handled inside the game. I have noticed that when I enable the dialog to test, it defaults to 640x480.. In-game, the resolution gets set to whatever the current desktop resolution is if it can't find a custom saved resolution setting. So if you were to specify 1280x720 in the unity dialogue (for testing purposes) then the game would still default to the current desktop resolution, but if you toggle to windowed mode, it will revert to 1280x720, not the specified resolution.

This is on OSX. I know OSX handles fullscreen differently to windows so I'm not sure if that's playing a part here.

TL/DR: Resolution changes are not being applied when going from fullscreen to windowed mode.

Thanks for your time, Sam

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 spraycanmansam · Aug 14, 2014 at 11:53 AM 0
Share

Still haven't found an answer for this one :/

avatar image J_P_ · Dec 14, 2014 at 08:50 PM 0
Share

I'm seeing the same behavior.. haven't found workaround yet

avatar image fafase · Dec 14, 2014 at 08:55 PM 0
Share

A while ago I had issue with fullscreen due to the DirectX setting, once removed it all went fine.

$$anonymous$$ine was actually a blue screen when switching windowed/full/windowed.

PlayerSettings->Other Settings->Use DirectX 11.

avatar image J_P_ · Dec 14, 2014 at 09:13 PM 0
Share

-fafase

This is on OSX. I already have that setting turned off, but I don't think it affects OSX standalone builds.

3 Replies

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

Answer by spraycanmansam · Aug 20, 2015 at 05:43 AM

Just thought I'd add an answer to my own question here...

Looks like they still haven't fixed this one, but I managed to find a work around. There's a problem with changing the resolution and full screen settings in the same frame. I worked around it by using a coroutine and waiting for a frame or so in between changing each setting, like so ---

     private IEnumerator WaitForScreenChange(bool fullscreen)
     {
         int width = Screen.width;
         int height = Screen.height;
 
         Screen.fullScreen = fullscreen;
 
         yield return new WaitForEndOfFrame();
         yield return new WaitForEndOfFrame();
 
         Screen.SetResolution(width, height, Screen.fullScreen);
     }
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 SkaredCreations · Dec 15, 2014 at 12:02 PM

Have you tried to change fullScreen before SetResolution (store the current Screen Width/Height before)?

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 myriamc · May 10, 2018 at 03:21 PM

Why don't you just use your function's parameter "fullScreen" as an argument to Screen.SetResolution()?

 Screen.SetResolution(width, height, fullScreen);
 
 // instead of
 
 Screen.SetResolution(width, height, Screen.fullScreen);

Also, it feels like you don't need to set Screen.fullScreen at all since changing the resolution sets the full screen mode too. So you end up with this one line only:

 Screen.SetResolution(width, height, fullScreen);

This way, you completely avoid this Unity's annoyance.

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

24 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

Related Questions

Can't run unity 2.6.1 on mac os x 10.6.3 2 Answers

Minimize MacOSX fullscreen and open URL 1 Answer

Unity fails to include .bundle for native code plugin when building Intel Mac player. 0 Answers

Is it possible to make custom OSX Player windows in Unity? 0 Answers

[OSX] Cannot tab out using Cmd+Tab - Solution? 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