Show FPS Counter in Unreal Engine 4

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.

Opening the dropdown box in the top left corner of the viewport.

On this new menu, in the viewport options section, tick the “Show FPS” box.

Enabling the fps counter in the viewport.

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

The FPS counter showing inside the editor.

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

Adding the f3 key press event to the player character blueprint.

From the pressed execution pin, create a new “Execute Console Command” node.

Adding the execute console command node to the f3 key press event

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.

Executing the stat fps console command

Demonstration

In this demonstration we show the third person example project turning the fps counter on and off during the game.

The fps counter toggling on and off in the top right corner.

Conclusion

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.

Further Resources:
Improve this system with our guide on input actions and input axis.

Official Unreal Engine Statistics documentation.

Be the first to comment

Leave a Reply

Your email address will not be published.


*