playMaker

Author Topic: APPLICATION FOCUS - just don't  (Read 1907 times)

Broken Stylus

  • Beta Group
  • Hero Member
  • *
  • Posts: 825
APPLICATION FOCUS - just don't
« on: October 05, 2021, 10:25:05 AM »
I was reminded of needing to post this for anyone new to Playmaker and to save you precious time and headaches.
I stopped using it years ago and never looked back.
APPLICATION FOCUS is perhaps the most useless and confusing System Event of all.
Not only a toggle breakpoint on both PAUSE and FOCUS used as global transitions on different states, in the same FSM, will imply that PAUSE has authority over FOCUS (breakpoints mess up with Playmaker events as some of them get memory holed), but in a proper setup FOCUS isn't even called when it should, that is, at least one frame after PAUSE.
Remove the breakpoints and both PAUSE and FOCUS are called in the same frame at the start of the application and this likely happens too later on, when the user sidesteps the application and returns into it.
If you thought that PAUSE was for when the application was put on hold at a higher OS level and FOCUS was triggered when the OS focused back onto the game, think again.
Or more importantly, don't use FOCUS at all. The logic would want FOCUS to be necessary but PAUSE is triggered both in and out of a running app (when it's not quitting altogether).

Simply use APPLICATION PAUSE alone and manage the application's state with bools.