Get Target FPS in Godot 4.2

Godot Version

4.2

Question

Hey! I have been making my first plugin I plan on using a lot. For my plugin, I need to access the target fps of the engine/game/runner/whatever it’s called. I don’t need the current fps, or the fps of the last second, or even the max fps. I need the fps that the engine is trying to reach, even if it doesn’t reach it. This article is outdated, but if I was using Godot 3.x, this would be solved with Engine.target_fps. Any way to get this in Godot 4.2?

Godot’s Engine.target_fps does affect the frame rate, but only for the render-cycle frames

Engine.target_fps was renamed to Engine.max_fps

I don’t think there’s a way to get the information you want. If vsync is enabled then you may be able to get the refresh rate of the monitor with DisplayServer.screen_get_refresh_rate(). If it’s disabled and Engine.max_fps is 0 then there’s no limit.

2 Likes

That’s unfortunate. I think I will use screen refresh rate and add a stipulation to the plugin’s README.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.