One essential debugging feature in any game engine is the frame rate counter also known as the FPS counter.
In this quick guide we will show you how to enable this feature inside Unreal Engine 4 and how to show this counter while the game is being played; even after packaging.
Framerate in the Editor
To show the fps counter inside the editor, firstly press the small arrow button on the top left of the viewport.
On this new menu, in the viewport options section, tick the “Show FPS” box.
In the top right of the viewport, the fps counter is now displayed with the frame time below it. Frame time is the time taken to produce one frame.
16.6ms is 60FPS
Framerate Counter in Game
To show the fps counter inside your game, we will firstly add the F3 keypress event to our character blueprint.
This can be any key you want
From the pressed execution pin, create a new “Execute Console Command” node.
Inside the Execute Console Command node, type stat fps into the command box. This is the command which will be sent to the game to toggle the frame rate counter on and off.
In this demonstration we show the third person example project turning the fps counter on and off during the game.
Your project now has access to the fps counter during editing and when you package your game into a standalone executable!
This fps counter will work correctly for all builds of the game including shipping builds.
There are many different stat commands that can display debug information to the player or tester.
Below are some links to further reading if you would like to look into the stat system further.
Improve this system with our guide on input actions and input axis.
Official Unreal Engine Statistics documentation.