Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

UEngine::OnLostFocusPause is never called

UEngine::OnLostFocusPause is never getting called which means, in turn, AHUD::OnLostFocusPause is never called. We'd like to know when the game has lost focus so we can stop the game from running in the background.

We had tried to work around this using FViewport::IsForegroundWindow() but

  1. Polling is (in this case!) worse than being event driven and

  2. This function, for us, calls FSceneViewport::IsForegroundWindow() and not FWindowsWindow::IsForegroundWindow() - and it ends up being surprisingly slow(!).

Profiling showed that almost 5% of the game thread was being spent inside FSceneViewport::IsForegroundWindow() (or functions that it calls) - more than ticking all of our (hundreds of!) actors combined!

Still, that's getting away from the main point - that UEngine::OnLostFocusPause() isn't ever being called leaving us with no good way (that I know about) of knowing whether we've lost focus - or gained it again!

Product Version: Not Selected
more ▼

asked Jul 16 '14 at 07:33 PM in C++ Programming

avatar image

348 14 15 27

avatar image Rama Jul 17 '14 at 09:48 AM

Do you mean 4.3 or 4.2 in your title?

Wishing you luck with this!

avatar image Neil.Griffiths Jul 17 '14 at 03:23 PM

Hey Rama! I mean 4.2 - though it doesn't look like it was fixed in 4.3 either!

I'll remove the version from the title since it's a little misleading. :)

And thanks!

avatar image Rama Jul 17 '14 at 05:05 PM

I am wishing you luck with this!

I had no idea that FSceneViewport::IsForegroundWindow was slow!


(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question