- Home /
Detecting and setting resolutions correctly
Guys, where am I supposed to put resolution detection code in Unity? When I put it in Awake of the first scene that loads, it can be easily compromised by the player pressing Alt+Tab before the scene fully loads, and everything goes terrible wrong.
Besides, I can’t predict all resolutions, so Unity logo sometimes gets stretched. How do I deal with that?
Answer by Meltdown · Apr 02, 2012 at 02:09 PM
You don't need to predict resolutions, just aspect ratios. You can also force an aspect ratio if you want your game to always look the same at any resolution.
Although I tend to shift GUI stuff around a little based on the aspect ratio.
You can also check current resolution in your game managers update method and adjust accordingly.
Thank you for your answer, $$anonymous$$eltdown, but that, however, is not what I was asking. I know how to detect aspect ratios and shift stuff around, what bothers me is black rectangles that I get ins$$anonymous$$d of my normal GUI elements if the user presses Alt+Tab while the resolution is being adjusted. So, basically, I’m looking for a way to either disable system hotkeys during this time or to just reload my textures when they tab back into the game. In case of the latter I’d have to detect this tabbing business, which I’ve no idea how to do.
Your answer
Follow this Question
Related Questions
Is there a way to make a script do something every time a new level loads? 1 Answer
Unity IAP InitializePurchasing taking too long. 1 Answer
How to change screen size with aspect ratio? C# 0 Answers
Changing screen resolution is cutting the very edge of my screen off 1 Answer
Mobile resolution problem 1 Answer