Lower Resolution for Retina Display

I want to run my game at half retina resolution on macbooks both for performance and battery reasons. I would prefer not to have a resolution selection at the start or in game.

As Unity offers Screen.SetResolution and Screen.dpi I was thinking this should be easy. If Screen.dpi>200 (highDPI screen) halve the resolution. For testing purpose I’m using 50 dpi.

{
Screen.SetResolution(Screen.currentResolution.width / 2, Screen.currentResolution.height / 2, true);
}```

Problem with my code seems to be that Unity remembers the resolution I set last and that dpi remains the same, no matter what resolution is set. This causes an infinite shrinking of my resolution on every restart. How do I clear the resolution setting? How do I get the actual screen resolution on start up with correct dpi?

You could probably base things off of the highest available resolution in Screen.resolutions. Note that Screen.dpi is not guaranteed to give valid results on all devices.

It’s pretty weird for a game that is capable of running at multiple resolutions to refuse to let the user control it, though.

That seems to work pretty nicely, thanks. I had not expected Screen.dpi to be resolution independent, but that seems to be the case. So I hope this will work on retina displays, but it looks promising.

My game has no settings at all, I’m trying to keep everything to the minimum.

Your customers will not thank you for having no settings.