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?

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.