How to disable frame rate throttle and VSync

I had some trouble finding how to disable the frame rate throttle when the game window isn’t in focus and also how to disable VSync so I thought I’d make a post to the forum for anyone in the future trying to do the same.

To remove the frame rate throttle just add this line to the start function of any entity in the scene:
((Xenko.Games.GameBase)Game).MinimizedMinimumUpdateRate.MinimumElapsedTime = new TimeSpan(0);
It sets the minimum time between frames to 0 letting the game run as fast as possible.

Note that this is only for when the game isn’t in focus. If you’ve set a limit to the frame rate normally then your game will actually run faster when the window is not selected. To change the max framerate when the window is in focus you can use this line:
((Xenko.Games.GameBase)Game).WindowMinimumUpdateRate.MinimumElapsedTime = new TimeSpan(0);

Finally, this line will disable VSync:
GraphicsDevice.Presenter.PresentInterval = Xenko.Graphics.PresentInterval.Immediate;
Adding it to the start function of any entity will work.

It’s possible this is all described in the engine’s manual but I wasn’t able to find it. Also if this isn’t the proper way to do this then let me know and I’ll update the post.

1 Like