How to get and show frame rate in game?

I know you can use a console command to show the frame rate. What I’m trying to do is give the user a nicer display via a widget which the user can toggle on or off. The problem is, I can’t seem to find the system’s fps so I can’t output the value. I tried using “get frame rate” but that didn’t do what I was expecting. I know it has to be somewhere because “stat fps” returns the value. I just don’t know from where.

Edit:
Also, I noticed that smooth frame rate doesn’t seem to work. My machine hits around 90 fps even with smooth set to a range of 22 to 62. Setting a fixed frame rate of 30 in the user settings does cap it at 30. However, changing that in code does nothing. It seems to only work in the settings window.

Changed in BP

No effect from BP change to 15 FPS, the actual is still above 60.

Fixed rate does set to 30 in project settings, but user changes still won’t take effect from code.

Capture3.PNG

As far as getting the actual frame rate, use GetWorldDetaSeconds and display the result of 1/Delta (one divided by delta). Then put that into a UMG string.

I’m really not super familiar with how the smooth frame rate setting works, but you can use a console command to limit frame rate and it works in a shipped game. You can execute console commands in Blueprint. The command is
t.MaxFPS=60

2 Likes

I tried t.MaxFPS but it still shows a higher frame rate than what was set. I’ve tried 30, 60. I’m still getting over 100 fps in some cases.