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 Doddler · Sep 27, 2013 at 05:17 AM · fullscreenshortcutwindows-standalonehotkey

Block or Override Alt-Enter Fullscreen

The project I'm currently working on runs at a fixed screen size of 800x600 and is deployed as a windows standalone. At that resolution though, when you switch to full screen on most monitors the image will stretch to whatever aspect ratio your monitor is. It's ugly and not ideal, and given the project changing aspect ratio or using a more flexible base resolution won't work.

The proper solution that I'm trying to figure out is to have a different full screen resolution from the windowed resolution, so I can pick a good resolution matching the aspect ratio. Optimally I'd just use the current desktop resolution (the project is simple enough that this is unlikely a performance issue). It should be simple to do using Screen.SetResolution, if it weren't for one issue: Unity handles alt-enter internally to automatically and toggles to full screen with the currently used resolution.

As best I've looked, I can't find a way to override this default behavior. You can't stop it, and you can't turn it off. The best solution I have so far is quite ugly too. When in fullscreen it checks if you're at 800x600 and then switching to a more favorable resolution. It results in multiple resolution changes, which on some displays can take 10-15 seconds, and it messes with the position any other applications you have open.

Is there any easy way to just disable the default alt-enter functionality? If I could just handle the shortcut myself it would be perfect.

tl;dr: I want the game to have a different windowed resolution from fullscreen resolution, ideally by handling alt-enter clicks myself rather than by the unity engine.

Comment
Add comment · Show 3
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 Jamora · Sep 29, 2013 at 09:25 PM 0
Share

I don't think there is any way to disable it from Unity. Alt-Enter is a Windows shortcut, and Unity doesn't really have any authority there...

avatar image Doddler · Sep 29, 2013 at 09:46 PM 0
Share

That's not true at all is it? Alt-enter is handled by the application, if it's not coded to handle it, it won't handle it. It's the go-to key combination for switching between windowed and full screen, but it isn't a windows shortcut.

avatar image Jamora · Sep 29, 2013 at 09:59 PM 0
Share

Yes, you're probably right... I was thinking Alt-Tab. Interestingly enough, my computer crashed when I switched a Unity game to full-screen mode. $$anonymous$$aybe because I have two monitors?

4 Replies

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

Answer by Achab · Apr 28, 2017 at 06:02 AM

Little update.

Unity have added the flag "Allow Fullscreen Switch" in Project Settings\Player\Resolution and Presentation. Works perfectly.

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 Doddler · Apr 28, 2017 at 06:16 PM 0
Share

This was a really old question, but it is a welcome answer none the less!

avatar image
2

Answer by Radetic · Jul 24, 2015 at 02:43 PM

Any answers for this question yet? I'm currently working on a project that is not supposed to go fullscreen by software requirements and the ALT+ENTER shortcut is really getting in the way.

Thanks in advance for any help provided

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
1

Answer by Eric5h5 · Sep 29, 2013 at 09:40 PM

 function Update () {
     if (Screen.fullScreen) {
         Screen.fullScreen = false;
     }
 }
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 Doddler · Sep 29, 2013 at 09:44 PM 1
Share

Thanks for the reply, that will effectively prevent fullscreen mode (through the rather roundabout way of waiting for the game to switch to full screen, and then switching back), but what I'm looking for is to have a different full screen resolution from desktop resolution, or being able to handle alt-enter usage myself.

avatar image
0

Answer by googler · Nov 13, 2013 at 08:00 AM

Same problem on Mac. I believe that you can do it only through the plugins and native libraries.

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

20 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

Related Questions

Hotkey to play animation 1 Answer

Shortcuts/hotkeys not working 0 Answers

Is there any hotkey to swich to the next/previous frame in the animation windows? 2 Answers

Identifying Windows resolution change at runtime 2 Answers

Custom Hotkeys with _ and then letter not typing 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