Detect when user minimizes application

Hey all, I was just trying to figure out how we can detect when a user has minimized the application (say, via alt+tab).

Here's what I'm trying to do. When the user minimizes the game, I'd like it to automatically pull up the escape menu I've created. I don't want the game to pause, I just want the escape menu to open. Is there a certain command that determines when the user has taken focus off of the game?

btw - This can be answered for Javascript or C#, either or both would be awesome!


what if you create a screen-wide transparent gui element and use OnMouseExit to pull up your escape menu.

The same problem. OnApplicationFocus detects minimizing only on Windows, but I need on Mac too.

Has anything been updated in 5.0+ to support this, I’m looking at the same problem now.