# UE4 : GetPlayerState() doesn't work in PlayerController code (template version is called)

**URL:** <https://forums.unrealengine.com/t/ue4-getplayerstate-doesnt-work-in-playercontroller-code-template-version-is-called/509192>\
**Category:** C++\
**Tags:** unreal-engine, UE4, CPP, question\
**Created:** [March 23, 2022, 3:13pm UTC](https://forums.unrealengine.com/t/ue4-getplayerstate-doesnt-work-in-playercontroller-code-template-version-is-called/509192 "2022-03-23T15:13:10Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Mallowina](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Mallowina](https://forums.unrealengine.com/u/Mallowina)\
**Post date:** [August 18, 2022, 7:26am UTC](https://forums.unrealengine.com/t/ue4-getplayerstate-doesnt-work-in-playercontroller-code-template-version-is-called/509192/2 "2022-08-18T07:26:52Z")

</div>

Just use #include “GameFramework/PlayerState.h”  
And than GetPlayerState() will work normal.

Correct include is important. I was in same situation.  
P.S.: Sorry for my English. I hope than can help you

---

_[View the full topic](https://forums.unrealengine.com/t/ue4-getplayerstate-doesnt-work-in-playercontroller-code-template-version-is-called/509192)._
