Set Vsync from code (2.1.4)

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By keke

I want to put a button in my game’s options menu to turn vsync on/off. How can I toggle vsync from code?

:bust_in_silhouette: Reply From: Empyrean

Yes, you can. To set vsync, you can:

OS.set_use_vsync(bool enable)

Where enable is true to turn on and false to turn off.


If you need to get current vsync value:

OS.is_vsync_enabled()

This will return bool value.