r208, Browser: On Suspended/Resumed not always triggering

Bugs will be moved here once resolved.

Post » Wed Jul 01, 2015 3:21 pm

Problem Description
If a stand-alone browser window loses focus into the desktop background (not minimized or in an adjacent tab) then the On Suspended / On Resumed triggers do not fire in the Browser object (with pause on unfocus = false). If Project Properties pause on unfocus is set True then the feature works correctly - but only in preview and not on export.

Attach a Capx
link to capx

Description of Capx
The capx displays 2 text objects to list Browser Triggers and Keyboard KeyDown and KeyUp Triggers.

Steps to Reproduce Bug
  • Run layout (Properties Pause On Unfocus set False) in stand-alone browser / NW window on one side of the desktop, with another application visible such that when you click on the 2nd window, the test browser window will remain visible
  • With the layout running, click on something to unfocus the test browser window, then click back on the test browser window
  • Observe that no Triggers are recorded in the Browser trigger text list when it comes back into focus
  • Then run the layout again, but with Properties Pause On Unfocus set True
  • Observe that the triggers fire correctly.

Observed Result
As described above. It appears that the Pause on Unfocus is able to detect all unfocus/blur conditions, but the browser triggers do not always register these. You can confirm that the browser is going out of focus by holding a key down when you click on another window and then releasing the key when it's out of focus - the key up trigger does not get recorded in this case. Additionally, if you do minimize the window, the Browser Page Is Visible boolean never becomes false.

Expected Result
The On Suspended / On Resumed triggers should fire when the window becomes back in focus when it is not in preview and they should fire with Pause on Unfocus set to false when running in preview. Without these triggers firing there is no way to detect if a key up trigger could have been missed by the unfocus / blur event. I apologize if I am misunderstanding the purpose of these triggers. If that is the case, could we have a On Focus and On Blur trigger to cover this?

Affected Browsers
  • Chrome: (YES)
  • FireFox: (YES)
  • Internet Explorer: (YES - Pause on Unfocus makes no difference and the test does not pause on unfocus...)

Operating System and Service Pack
W8.1 x64

Construct 2 Version ID
r208 64 bit
I only occasionally visit - I'm learning C# for Unity, but c2 is still a respectable game engine imo....
B
73
S
19
G
66
Posts: 2,198
Reputation: 42,188

Post » Thu Jul 02, 2015 11:36 am

This is by design. Simply unfocusing the window is not supposed to suspend it - suspending only happens when the window is in the background or no longer visible, such as minimising the window on desktop, or going back to the home screen on mobile. "Pause on unfocus" is a preview-only feature for convenience that suspends the game when you unfocus it, so the game doesn't keep running if you want to go back to the editor for a bit. Since it really suspends the game it fires "on suspend" and "on resume" just like the window was going in to the background, but this is specific to the "pause on unfocus" feature and not supposed to happen normally.
Scirra Founder
B
387
S
230
G
87
Posts: 24,249
Reputation: 192,240

Post » Thu Jul 02, 2015 1:21 pm

Thanks @Ashley, all understood - is there any way to detect when the window is blurred / out of focus but still maximized on the desktop? I would be happy for this to be an option to not just be a debug feature... Rather than continue discussing in a closed bug section I'll open up a new thread to request this as a feature if it's possible.
I only occasionally visit - I'm learning C# for Unity, but c2 is still a respectable game engine imo....
B
73
S
19
G
66
Posts: 2,198
Reputation: 42,188


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 1 guest