FViewport::LockMouseToViewport isn't working?

Hey -

Looking at the Tower Defense demo in the Learn tab of the launcher (which I believe has the functionality you’re looking for), it appears that you’d have to make a call to SetUserFocus() to check when the game window regains focus.

The idea of using code is also not a bad idea and in fact if you are able to setup a system that works for you, you could then submit a pull request to have your code added to the engine for future use to make the process simpler.

I can’t find any call to SetUserFocus? Can you please specify exactly on which line that call is made? I have search through the entire solution without finding it :confused:

The call that makes the trick is FSlateApplication::Get().SetKeyboardFocus(SharedThis(this));. The implementation of that method calls SetUserFocus but the example itself does never call SetUserFocus directly.

Anyhow I don’t like the busy wait implementation since it must be checked every tick if we need to call it again. Would be much cleaner to rely on events when gaining and/or losing application focus. However that doesn’t seems to work either. Have another post up regarding that issue.

Okay, APlayerController::SetInputMode is the way to go. Just need those application focus events to work properly now.