Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Moonwall on May 23, 2016, 08:14:26 AM

Title: Pause game when alt+tab is pressed
Post by: Moonwall on May 23, 2016, 08:14:26 AM
Hello!
I'm looking for a solution to pause the game when it looses focus - for example if someone plays in windowed mode, and click on another app, or if he presses alt+tab.
I already have a pause menu.
I tried to make a key combination - get key down alt, then get key down tab, but it doesn't work.
I also tried application pause, and application focus, but I think it doesn't work in desktop apps.
Does anyone has any idea?

Thank you very much!
Title: Re: Pause game when alt+tab is pressed
Post by: PlaymakerNOOB on May 24, 2016, 09:12:36 PM
Application Focus should be what you want for detecting if its the current active window or not.

Before jumping into figuring out a pausing solution, make sure that Application focus is setup correctly by having it print something to console when it loses focus.

Pausing accurately can get frustrating if your doing it yourself.  You might want to save the headache and get something that is Unity 4 and 5 compatible w/playmaker support like Time Control and Pause Kit  https://www.assetstore.unity3d.com/en/#!/content/9603
Title: Re: Pause game when alt+tab is pressed
Post by: Raknill on August 01, 2016, 04:56:12 PM
Thanks for the link to that asset; I try not to default to the asset store too much, but when you're a one man studio, you've gotta pick your battles.