I am making an application for Standalone Windows. Is there anyway to have a maximised windows screen by default? If I do full screen, the Application Title bar just disappear. I want to keep that bar, but maximised windows when start.
Here is my settings:
Fullscreen Mode : Maximized Window
Default is Native Resolution: True
Resizable Window: True
You probably want to use FullscreenMode.MaximizedWindow in your script. However, I tried that and it still didn’t work. This seems like a bug to me. You should report it to Unity.
Have you figured out a workaround. I’m also facing this issue. Standalone player launches with a gap above the top of the screen and a little between the left of the screen. Clicking the maximize button fills in these gaps, but then it launches this way again next time
Edit: I’ve scoured the internet trying to find a built-in solution for Unity but it seems like there isn’t support to Maximze the window via script. However I found a quick work-around to forcing the game window to maximize using windows dll scripts:
public class Settings : MonoBehaviour {
[DllImport("user32.dll")]
private static extern IntPtr GetActiveWindow();
[DllImport("user32.dll")]
public static extern bool ShowWindowAsync(int hWnd, int nCmdShow);
void Awake() {
if (!Screen.fullScreen && !Application.isEditor) // auto maximize window
ShowWindowAsync(GetActiveWindow().ToInt32(), 3);
}
}
This forces the window to maximize on start.
Heres an enumeration containing all the possible window states (3 being what I used above):