[SOLVED] Input lag when tabbing out

How do I stop the game from getting input lag when tabbing out and back in?

When I start my game, there is no input lag (camera rotation and movement are smooth). But when I change my window to do something else on the computer and switch back to the game, there is input lag which makes the game annoying to play. I don’t think the FPS is lowered either.
It happens both when running the preview and also when playing on the exported game.

The game is a fast-paced shooter, and this issue makes the game virtually unplayable.

Is there a fix for this issue?

Project download


The lag is being caused by the game switching into borderless mode when you tab out.
Set the game to fullscreen when the window is focused again to prevent the input lag.

It sounds like the game comes out of exclusive fullscreen mode ino borderless when you alt+tab. Maybe put an event to re-fullscreen the game when player alt tabs back into it?

That seems to be the solution. Thanks! Why does borderless cause the game to have input lag? Also, isn’t the fullscreen in GDevelop already technically borderless, since it doesn’t lock your cursor in the game nor does it do that black flash when you focus/unfocus the game?

For the second part, I’m not sure, I’ve never used a fullscreen event in my game.
Borderless windowed causes input lag due to how it works, here’s some further but short explanation from a Fallout New Vegas performance guide.

It might not be relevant for GDevelop though, as FNV uses DirectX 9 - almost 2 decades old.