- Home /
OSX Standalone incorrectly fullscreens on Retina Display
Hi everyone,
Note: I'm using Unity Pro 3.5.7f6
Over the past several months, I integrated my company's first game Loc, with Leap Motion. When we first developed the game we had never tested it on a "retina display". However now that we're updating it we need to support them, but when fullscreen is enabled the game anchors to the corner and has a flickering white border. This video link illustrates the problem.
I've done a lot of searching and tried the "AspectUtility" script, but that doesn't seemed to have solved it. (Although it did help with a few other fullscreen issues). Additionally, I've found this post: [url]http://forum.unity3d.com/threads/145534-Mountain-Lion-MacBook-Pro-Retina-gt-problem-for-Unity-games[/url] but it doesn't seem that the issue was ever resolved.
Thanks for any help!
Answer by syslord2k2 · Jul 25, 2013 at 09:55 AM
The link you posted actually contains the solution to your problem, althoug it is only described for javascript:
if (Screen.fullScreen)
{
//MacBook Pro Retina 15: width = 2880 , MacBook Pro Retina 13: width = 2496 ?
//could check device model name, but not sure now about retina 13 device model name
//if last resolution is almost retina resolution...
var resolutions : Resolution[] = Screen.resolutions;
if (resolutions.length && resolutions[resolutions.length - 1].width > 2048)
{
Screen.fullScreen = false;
yield;
Screen.fullScreen = true;
yield;
}
}
For C# i handled this in an update function because you actually have to wait for a frame to be rendered before switching back, i did this by adding two booleans as members to my main class:
bool m_fullscreenswitched
bool m_fullscreensecond
and then did this in the Update function:
#If UNITY_STANDALONE_OSX
if (Screen.fullScreen || m_fullscreensecond) {
if (!m_fullscreenswitched && !m_fullscreensecond) {
Screen.fullScreen = false;
m_fullscreensecond = true;
} else if (!m_fullscreenswitched && fullscreensecond) {
Screen.fullScreen = true;
m_fullscreenswitched = true;
}
}
#endif