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 gmerriment · Dec 02, 2010 at 05:05 AM · resolutionfullscreen

Lock Resolution

Is it possible to lock a game at a set resolution and prevent the user from resizing the window or switching fullscreen? Fullscreen wouldn't be a problem except that if you switch to fullscreen and back, Mac OS X retains the monitor's native resolution in the new window size regardless of its size prior to fullscreen.

Another solution might be to allow fullscreen, but return the window to the preferred size on minimizingthis would require an onFullscreen() callback (or something like it).

Much help would be appreciated!

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

1 Reply

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

Answer by Rennat · Dec 02, 2010 at 05:14 AM

Screen.fullScreen is a bool property that can be read or set. You can use this to determine if the player has just left fullscreen and switch to a different resolution.

example:

private var wasFullScreen : Boolean = false;

function Update () { if (wasFullScreen && !Screen.fullScreen) { // this gets executed once right after leaving full screen } if (!wasFullScreen && Screen.fullScreen) { // this gets executed once right after entering full screen } wasFullScreen = Screen.fullScreen; }


edit:

If you're building for the web player you can disable the right click menu so people can't go fullscreen to begin with.

To get to the setting go to File > Build Settings, then choose Player Settings and select No Context Menu for the Web Player Template.

alt text

Comment
Add comment · Show 4 · 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 gmerriment · Dec 02, 2010 at 05:49 AM 0
Share

Excellent, I wondered if it could be used that way. Thank you!

avatar image gmerriment · Dec 02, 2010 at 06:12 AM 0
Share

Ideally, it would be better if I could completely disable fullscreen and resolution changes, but this serves as a workable substitute.

avatar image Rennat · Dec 02, 2010 at 06:38 AM 0
Share

well you could test for fullscreen every frame and set it to false if if ever goes fullscreen :D or if you're using a web player there is a setting to hide the context (right click) menu so there is no option to go fullscreen.

avatar image gmerriment · Dec 03, 2010 at 04:31 AM 1
Share

That's what I ended up doingit does prevent fullscreen, but there is an unfortunate momentary "blink". And it is counter-intuitive: having the option implies that the user can do it, and preventing its execution is more frustrating than not giving the user the option. $$anonymous$$aybe an item for the Unity wish list...

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

No one has followed this question yet.

Related Questions

webplayer resolution problems/issues/oddities and frame rate weirdness 6 Answers

how to make a global Screen resolution? 1 Answer

How can I enter fullscreen mode in a very low resolution? 0 Answers

How to Play Your Game Fullscreen on Different Resolutions 1 Answer

Change resolution, but not screen size. 1 Answer


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