Last active
May 16, 2024 06:26
-
-
Save sdelrue/b9eaf57f7e0dd55ddaa758186895d351 to your computer and use it in GitHub Desktop.
This minizes the Unity window (Editor or Build) from code. Only tested on windows.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Runtime.InteropServices; | |
public class Minimize : MonoBehaviour { | |
private void OnMimize() { | |
ShowWindow(GetActiveWindow(), 2); | |
} | |
[DllImport("user32.dll")] | |
private static extern bool ShowWindow(IntPtr hwnd, int nCmdShow); | |
[DllImport("user32.dll")] | |
private static extern IntPtr GetActiveWindow(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment