If you’re a game developer using Unreal Engine, knowing about Frame Per Second (FPS) and how to show it is essential. FPS measures how smoothly your game runs, impacting the player’s experience. A higher FPS means smoother gameplay, keeping players engaged and satisfied. It also ensures your game works well on different computers, making it accessible to a wider audience.
Balancing graphics with FPS is crucial. You want your game to look amazing without causing lag or slowdowns. This is especially important for projects in Virtual Reality (VR) and Augmented Reality (AR), which require even higher frame rates for a comfortable and enjoyable experience. Smooth animations and transitions are also key for a polished game, and understanding how to optimize them with FPS ensures a visually impressive experience without sacrificing performance.
Mastering FPS in Unreal Engine is a game-changer for developers. So, before we get into how to optimize your project’s FPS, I’ll show you how to identify how many frames per second your game is running at.
1. Show FPS
In the viewport, click the hamburger menu and select Show FPS. Or just use the shortcut CTRL+SHIFT+H.
This toggles the display of frames per second in the viewport. The FPS will begin to show on the right side of the Unreal Engine viewport.
2. Editor Preferences
- Go to Edit and then ‘Editor Preferences…’
- Enter ‘Frame Rate’ in the search bar.
- Enable ‘Show Frame Rate and Memory‘ and the FPS will show on the right top corner.
The Memory statistic shows how much RAM the currently opened Unreal Engine editor is using.
3. Console Command (stat fps)
To see the frames per second in game, type ‘stat fps’ into the console (Cmd).
It’s useful to remember these three frame duration values for 30, 60, and 90 fps:
- 30 FPS: 33.33 milliseconds (ms)
- 60 FPS: 16.67 milliseconds (ms)
- 90 FPS: 11.11 milliseconds (ms)
To find the time in milliseconds, you divide 1000 by the frames per second.
Other useful commands are:
- stat unit
- stat UnitGraph
- stat Engine
- stat Game
- Console Command List
4. Console Command in Blueprints
Another way to run the console command is to use the blueprint node ‘Execute Console Command‘ and enter the command ‘stat fps’.
5. Widget Blueprint (UI)
If you want to show the FPS directly in the final build of your game or Unreal Engine project, you should build it in the UI.
To create a User Interface (UI), simply right-click on the Content Browser, navigate to the user interface, create a Widget Blueprint and follow these steps.
- Add a Canvas Panel
- Add Text inside the Canvas Panel
- With the Text selected, go to the Details Panel -> Content -> Text -> Bind -> + Create Binding
- Create an integer variable called FPS
- Create a Format Text node and connect it between the FPS variable and the Return Node.
- Enter in Format: {Input Pin} FPS
- Now head back to the Event Graph and Set the FPS variable connecting it to the Event Tick.
- Divide 1 by In Delta Time and set the result as the FPS variable value.
Finally just go to another Blueprint, like the Level Blueprint, Create Widget and connect it to Add To Viewport to show in game the UI you just created.
Learn more