|
Is it possible to start an app (standalone PC Unity app) with a maximized window? The default resolution I put int the player is not exactly what I'm looking for: a window that expands in the whole available desktop working area (1 monitor) without interfering with the windows task bar.
(comments are locked)
|
|
If you want to maximize your standalone unity app running in Window Mode, you can do so by using Screen.currentResolution to get the current desktop resolution. You can then use SetResolution with the desktop resolution, BUT you need to reduce the arguments width and height to give room for the Window borders. My guess is that SetResolution was designed for fullscreen and it doesn't really do the job for when you need to change the Window size in Window Mode. SetResolution changes the client area e.g. rendered viewport within the Window. It seems that if SetResolution results in a window greater than the desktop resolution then Unity shrinks the window. The workaround is to take your desired window size and subtract it with the current window border size. In C# you can use the native method calls GetWindowRect and GetClientRect to calculate the border sizes. Just want to add that GetWindowRect and GetClientRect is not part of .NET / Mono. It's a native code function (in the User32.dll) of windows. If you are on Mac or any other platform you need to find something equivalent. Btw. You can use those function in any language in Unity. Both UnityScript and C# are compiled to CIL. There are some language features (like properties, interfaces) that can only be defined in C#, but external functions / interfaces can be used by all languages. I still prefer C# ;)
Jun 12 '12 at 10:50 AM
Bunny83
Good point Bunny!
Jun 12 '12 at 11:21 AM
keld-oelykke
(comments are locked)
|
|
It looks like fullscreen mode. To run unity in window mode you can change player settings in Edit->Project Settings->Player and set "Default Is Full Screen" property to false. Also you can change it programmatically by using Screen class.
(comments are locked)
|

also unanswered: http://answers.unity3d.com/questions/27490/minimizing-and-maximizing-by-script.html
"the whole available desktop working area" usually refers to the whole desktop, but what do you mean by "1 monitor"? Do you mean you have two monitors but want to display it on just one, or do you mean you only have one monitor at all? If you have two monitors, the whole desktop will cover both monitors and not just one.