Skip to content

FPS Counter

Introduction

A widget used to display the current framerate

Dependencies

The FpsCounter relies on other components of this plugin to work:

  • Logger: Used to log useful information to help you debug any issues you might experience
  • Game Instance: Used to monitor for input device changes and handle saving/loading game data

Required Widgets

There is already a FpsCounter_Implementation that you can use in your projects. But if you create your own instance of this widget, you need to add the following before you can compile:

Name Description Type
FramerateText The text block used to display the framerate UTextBlock*

API Reference

Properties

Property Description Type Default Value
UpdateDelay The delay in seconds between each update float 0.125f
HighFramerate A framerate that is considered high and will use the high color int 60
MediumFramerate A framerate that is considered medium and will use the medium color int 30
HighColor The color used to display high framerates FLinearColor FLinearColor::Green
MediumColor The color used to display medium framerates FLinearColor FLinearColor::Yellow
LowColor The color used to display low framerates FLinearColor FLinearColor::Red

Functions

Name Description Params Return
UpdateVisibility Update the visibility of the widget IsVisible (bool)
Is the widget visible?

Blueprint Usage

You can use the FpsCounter using Blueprints by adding one of the following nodes:

  • Ultimate Starter Kit > UI > Update Visibility

C++ Usage

Before you can use the plugin, you first need to enable the plugin in your Build.cs file:

PublicDependencyModuleNames.Add("USK");

The FpsCounter can now be used in any of your C++ files:

#include "USK/Widgets/FpsCounter.h"

void ATestActor::Test()
{
    // FpsCounter is a pointer to the UFpsCounter
    FpsCounter->UpdateVisibility(IsVisible);
}