Such as, for when I want to launch an external web page based on users having clicked some button, and the game should be temporarily minimized until the user wanting to come back to the application?
I allways use this.
import System;
import System.Runtime.InteropServices;
@DllImportAttribute("user32.dll")
public static function ShowWindow(hwnd:IntPtr,nCmdShow:int):boolean{};
@DllImportAttribute("user32.dll")
public static function GetForegroundWindow ():IntPtr{};
@DllImportAttribute("user32.dll")
public static function GetActiveWindow ():IntPtr{};
function OnGUI () {
if(GUI.Button(Rect(100,200,100,50),"Minimize")){
//Minimize the window
ShowWindow(GetActiveWindow(),2);
}
}
Ordinarily, if you just call the default browser, it should pop up over your game, "minimizing it". Something like this should do the trick:
System.Diagnostics.Process.Start("http://google.com/");
Note that this doesn't work in the web player.
Other than that, you would have to write a C++ plugin that hooked into the actual application window so you could send a Minimize message, and I don't know if Unity exposes the Win32 application environment to plugins or not.