# How to show FPS ingame?

**URL:** <https://forums.unrealengine.com/t/how-to-show-fps-ingame/278127>\
**Category:** Pipeline & Plugins\
**Tags:** Frame-Rate, fps, unreal-engine, editor, UE4, question\
**Created:** [March 23, 2014, 9:09pm UTC](https://forums.unrealengine.com/t/how-to-show-fps-ingame/278127 "2014-03-23T21:09:23Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Albert\_Espin\_1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Albert\_Espin\_1](https://forums.unrealengine.com/u/Albert_Espin_1)\
**Post date:** [March 23, 2014, 9:09pm UTC](https://forums.unrealengine.com/t/how-to-show-fps-ingame/278127/1 "2014-03-23T21:09:23Z")

</div>

Hi, I know how to show FPS in the editor, but how to show them while playing?

---

<div class="post-metadata">

**Author:** ![Rama](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rama/32/882413_2.png) [@Rama](https://forums.unrealengine.com/u/Rama)\
**Post date:** [March 23, 2014, 9:10pm UTC](https://forums.unrealengine.com/t/how-to-show-fps-ingame/278127/2 "2014-03-23T21:10:29Z")

</div>

#Console Command

press ~

type

```
stat fps

```

#As a Console Command At Level Start

> **[Executing console commands at game start?](https://forums.unrealengine.com/questions/16340/executing-console-commands-at-game-start.html)**
>
> Where can i write commands to be executed at when the game starts? For example set the FOV to 110.

Rama

---

<div class="post-metadata">

**Author:** ![Albert\_Espin\_1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Albert\_Espin\_1](https://forums.unrealengine.com/u/Albert_Espin_1)\
**Post date:** [March 23, 2014, 9:16pm UTC](https://forums.unrealengine.com/t/how-to-show-fps-ingame/278127/3 "2014-03-23T21:16:14Z")

</div>

Thanks, Rama, you’re everywhere! Apparently in some keyboards it’s the ^ key. Is there a way to make it also show when playing in “Selected Viewport”?

---

<div class="post-metadata">

**Author:** ![Rama](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rama/32/882413_2.png) [@Rama](https://forums.unrealengine.com/u/Rama)\
**Post date:** [March 23, 2014, 9:18pm UTC](https://forums.unrealengine.com/t/how-to-show-fps-ingame/278127/4 "2014-03-23T21:18:26Z")

</div>

you’re welcome!

please check mark my reply above if it answered your question, and try to comment on my answer to keep everything in one place 🙂

---

<div class="post-metadata">

**Author:** ![Albert\_Espin\_1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Albert\_Espin\_1](https://forums.unrealengine.com/u/Albert_Espin_1)\
**Post date:** [March 23, 2014, 9:58pm UTC](https://forums.unrealengine.com/t/how-to-show-fps-ingame/278127/5 "2014-03-23T21:58:14Z")

</div>

Checked. The console command works great, done just as in Kismet.

---

<div class="post-metadata">

**Author:** ![brightside.pro](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@brightside.pro](https://forums.unrealengine.com/u/brightside.pro)\
**Post date:** [March 24, 2014, 3:25pm UTC](https://forums.unrealengine.com/t/how-to-show-fps-ingame/278127/6 "2014-03-24T15:25:49Z")

</div>

It’s possible to show FPS on mobile iOS/Android?

**Updated:**

1. Open Level Blueprint from toolbar

2. Add function ‘Execute Console Command’

3. Enter ‘stat FPS’ in ‘Command’ field

4. Attach ‘Event Begin Play’ to ‘Execute Console Command’

5. Click ‘Compile’ in toolbar

6. Run on device

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_fb2d0bf6](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_fb2d0bf6](https://forums.unrealengine.com/u/anonymous_user_fb2d0bf6)\
**Post date:** [March 24, 2014, 3:49pm UTC](https://forums.unrealengine.com/t/how-to-show-fps-ingame/278127/7 "2014-03-24T15:49:52Z")

</div>

‘stat unit’ may be also useful.  
This will show game and render thread times.

---

<div class="post-metadata">

**Author:** ![NeroViper](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@NeroViper](https://forums.unrealengine.com/u/NeroViper)\
**Post date:** [November 26, 2014, 3:23pm UTC](https://forums.unrealengine.com/t/how-to-show-fps-ingame/278127/8 "2014-11-26T15:23:55Z")

</div>

old thread but in case anyone was wondering: you can also access the console commands in mobile with 4 finger tap

---

<div class="post-metadata">

**Author:** ![Syntopia](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Syntopia](https://forums.unrealengine.com/u/Syntopia)\
**Post date:** [July 2, 2015, 3:51pm UTC](https://forums.unrealengine.com/t/how-to-show-fps-ingame/278127/9 "2015-07-02T15:51:06Z")

</div>

I did not find the standard function to get the frame rate in C++ so I get them this way:

Tick execute in second so many times how many frames per second is displayed, so you can count how many times was called tick per second using a timer.

![48833-скриншот+2015-07-02+18.40.13.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/0/0/60093052906c197d022fe413c00e71734be8fc1f.png)

```
void AGameCharacter::BeginPlay()
    {
    	Super::BeginPlay();
    	
    	FTimerHandle FPSTimerHandle;
    	GetWorld()->GetTimerManager().SetTimer(FPSTimerHandle, this, &AGameCharacter::ShowFrameRate, 1.f, true);
    
    }

    int FPS = 0;
    
    void AGameCharacter::Tick( float DeltaTime )
    {
    	Super::Tick(DeltaTime);
    
    	FPS++;
    }

    void AGameCharacter::ShowFrameRate()
    {
    	GEngine->AddOnScreenDebugMessage(0, 1.f, FColor::Yellow, "FPS: " + FString::FromInt(FPS) + " ms: " + FString::SanitizeFloat(FApp::GetDeltaTime() * 1000));
    	FPS = 0;
    }
```

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_f6c55d0c1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_f6c55d0c1](https://forums.unrealengine.com/u/anonymous_user_f6c55d0c1)\
**Post date:** [March 29, 2016, 1:28am UTC](https://forums.unrealengine.com/t/how-to-show-fps-ingame/278127/10 "2016-03-29T01:28:31Z")

</div>

How did you know that ? 😃 , It works.

---

<div class="post-metadata">

**Author:** ![gnuchev](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@gnuchev](https://forums.unrealengine.com/u/gnuchev)\
**Post date:** [September 7, 2016, 9:11pm UTC](https://forums.unrealengine.com/t/how-to-show-fps-ingame/278127/11 "2016-09-07T21:11:25Z")

</div>

Thank you, it’s very helpful!

---

<div class="post-metadata">

**Author:** ![Midsoft\_Games](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Midsoft\_Games](https://forums.unrealengine.com/u/Midsoft_Games)\
**Post date:** [September 7, 2016, 9:37pm UTC](https://forums.unrealengine.com/t/how-to-show-fps-ingame/278127/12 "2016-09-07T21:37:32Z")

</div>

1. In the level blueprint, create an Event BeginPlay.
2. Add an Execute Console Command.
3. The command will be “Stats FPS”.
4. Connect the Event BeginPlay with the Execute Console Command.

_In the toolbar, hit “Launch” to test it, because if you will play it in the editor, you won’t be able to see the FPS._

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_ea78ae96](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_ea78ae96](https://forums.unrealengine.com/u/anonymous_user_ea78ae96)\
**Post date:** [September 30, 2016, 9:57am UTC](https://forums.unrealengine.com/t/how-to-show-fps-ingame/278127/13 "2016-09-30T09:57:37Z")

</div>

Hi !  
Can you tell me how to stop this timer after 30 seconds in showframerate() function.

---

<div class="post-metadata">

**Author:** ![Syntopia](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Syntopia](https://forums.unrealengine.com/u/Syntopia)\
**Post date:** [September 30, 2016, 3:58pm UTC](https://forums.unrealengine.com/t/how-to-show-fps-ingame/278127/14 "2016-09-30T15:58:30Z")

</div>

As a variant, you can create another timer, so that he called 1 time after 30 seconds launch.

GetWorld()-\>GetTimerManager().SetTimer(SomeTimerHandle, this, &AGameCharacter::StopShowFrameRate, 30.f, false);

StopShowFrameRate()  
{  
GetWorld()-\>GetTimerManager().ClearTimer(FPSTimerHandle);  
}

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_471e3423](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_471e3423](https://forums.unrealengine.com/u/anonymous_user_471e3423)\
**Post date:** [October 18, 2016, 1:34pm UTC](https://forums.unrealengine.com/t/how-to-show-fps-ingame/278127/15 "2016-10-18T13:34:00Z")

</div>

the command should be “stat fps”, not “stats fps”.

---

<div class="post-metadata">

**Author:** ![polterageist](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@polterageist](https://forums.unrealengine.com/u/polterageist)\
**Post date:** [April 5, 2018, 11:43am UTC](https://forums.unrealengine.com/t/how-to-show-fps-ingame/278127/16 "2018-04-05T11:43:25Z")

</div>

You can get stat fps data directly from engine. It stores in global engine variables GAverageFPS and GAverageMS (defined in UnrealEngine.cpp for use with extern). It calculates every engine tick by the next algorithm:

```
// Calculate the average frame time via continued averaging.
static double LastTime	= 0;
double CurrentTime = FPlatformTime::Seconds();
float FrameTime = (CurrentTime - LastTime) * 1000;
// A 3/4, 1/4 split gets close to a simple 10 frame moving average
GAverageMS = GAverageMS * 0.75f + FrameTime * 0.25f;
LastTime = CurrentTime;
// Calculate average framerate.
GAverageFPS = 1000.f / GAverageMS;

```

I’m looking now for a stock functionality to get it in blueprint, but if there is no such, you can create yours.  
Example:

```
float UMyFunctionLibrary::GetAverageFPS()
{
	extern ENGINE_API float GAverageFPS;
	return GAverageFPS;
}
```

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_5a32e207](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_5a32e207](https://forums.unrealengine.com/u/anonymous_user_5a32e207)\
**Post date:** [July 10, 2018, 3:32am UTC](https://forums.unrealengine.com/t/how-to-show-fps-ingame/278127/17 "2018-07-10T03:32:34Z")

</div>

I am wondering if I need to get GAverageFPS from a plugin, then how should I do to get this variable?

---

<div class="post-metadata">

**Author:** ![polterageist](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@polterageist](https://forums.unrealengine.com/u/polterageist)\
**Post date:** [July 10, 2018, 4:44pm UTC](https://forums.unrealengine.com/t/how-to-show-fps-ingame/278127/18 "2018-07-10T16:44:28Z")

</div>

Exactly the same way as I showed above. Type “extern ENGINE\_API float GAverageFPS;” inside the plugin’s function. Here is no difference.

---

<div class="post-metadata">

**Author:** ![Somesh.Patel](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Somesh.Patel](https://forums.unrealengine.com/u/Somesh.Patel)\
**Post date:** [November 30, 2020, 9:49am UTC](https://forums.unrealengine.com/t/how-to-show-fps-ingame/278127/20 "2020-11-30T09:49:07Z")

</div>

Thanks a lot man, you just solved my 1 week of search.

Much appreciated.

Thanks Again 🙂

---

<div class="post-metadata">

**Author:** ![Dharma\_Reddy\_K](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Dharma\_Reddy\_K](https://forums.unrealengine.com/u/Dharma_Reddy_K)\
**Post date:** [May 23, 2021, 1:56pm UTC](https://forums.unrealengine.com/t/how-to-show-fps-ingame/278127/21 "2021-05-23T13:56:35Z")

</div>

Wow…It works like charm

[Next page](https://forums.unrealengine.com/t/how-to-show-fps-ingame/278127.md?page=2)
