Way of changing drawing fps runtime (in code)

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

Hi, I am working on my settings screen for now, and I was wondering where I could change the framerate at which the game is drawn, while in-game in the settings menu.

I tried doing:

ProjectSettings.set("debug/settings/fps/force_fps", framerate)

but to no avail.

How can I set drawing framerate while in-game?

Kind regards,

~FortunePilot

:bust_in_silhouette: Reply From: Trollend

Use Engine.set_target_fps(value)

Source: Engine — Godot Engine (stable) documentation in English

To confirm it works as expected, go to Project → Project Settings → Debug → Settings → Check Print FPS.