Is there a function to minimize Unity app when it is running on full screen mode in a build?
Not in Unity itself as this is a pure OS specific functionality and some don’t have this at all. Think about WebGL builds or console builds. Even on mobile apps “minimizing” in the classical sense does not exist because apps entering background mode (Android) can be kicked out of memory whenever the OS thinks it’s necessary.
So no, Unity does not provide any generalized API for that. So you have to use an OS specific approach.
is it so? That is strange.
For now, I am just switching between window and non-windowed. But it would be good if there was a solution for this.
private void Update () {
if (Input.GetKeyDown (KeyCode.R)) {
Screen.fullScreen = !Screen.fullScreen;
}
}
Why is it strange? Swtiching between fullscreen and windowed mode is a different story. Yes, this also does not apply to all platforms, but is much more common. Even WebGL has a fullscreen mode, but there’s no minimize. There are also a lot of different fullscreen modes which has to do with hardware exclusive access of the application or just running a fullscreen window (which is much more common nowadays). The whole multitasking aspect of applications belong to the OS. Just as an example: In a webGL build, pressing ESC will always exit fullscreen mode and your application looses mouse control. That’s a feature of the browsers security and can not be prevented.