[DllImport("user32.dll")]
public static extern IntPtr FindWindow(string className, string windowName);
[DllImport("user32.dll")]
internal static extern IntPtr SetForegroundWindow(IntPtr hWnd);
[DllImport("user32.dll")]
internal static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
private void GetFocusWin() {
IntPtr hWnd = FindWindow(null, "Your App Name");
if (hWnd != IntPtr.Zero) {
Debug.Log("GetFocusWin() setting foreground window, showing window SW_SHOWDEFAULT");
SetForegroundWindow(hWnd);
Debug.LogWarning("GetFocusWin() failed, hWnd is 0!");