# RESTARTGAME() - Keeps resetting GameState Values

**URL:** <https://forums.unrealengine.com/t/restartgame-keeps-resetting-gamestate-values/323202>\
**Category:** C++\
**Tags:** gamemode, gamestate, unreal-engine, CPP, question\
**Created:** [June 26, 2015, 11:54pm UTC](https://forums.unrealengine.com/t/restartgame-keeps-resetting-gamestate-values/323202 "2015-06-26T23:54:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_624ad6e91](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_624ad6e91](https://forums.unrealengine.com/u/anonymous_user_624ad6e91)\
**Post date:** [June 26, 2015, 11:54pm UTC](https://forums.unrealengine.com/t/restartgame-keeps-resetting-gamestate-values/323202/1 "2015-06-26T23:54:28Z")

</div>

Hi guys,

So I’m trying to implement the concept of rounds, and I have a `maximumNumRounds` under GameMode, and I keep track of the total number of rounds under my GameState.

So if `GameState->TotalNumRounds < maximumNumRounds` then we can restart the game when the time runs out using: `RestartGame()`. But no matter how I tried to implement this, the values keep getting reset to default (I tried seamless and non-seamless).

Any thoughts on the matter would be appreciated. (I would like to refrain from having to create a custom class just to keep track of said values).

ty

---

<div class="post-metadata">

**Author:** ![Devero](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Devero](https://forums.unrealengine.com/u/Devero)\
**Post date:** [June 27, 2015, 12:05am UTC](https://forums.unrealengine.com/t/restartgame-keeps-resetting-gamestate-values/323202/2 "2015-06-27T00:05:32Z")

</div>

Hi Venros,

Gamestates are destroyed and recreated on restarts. The Game Instance class is persistent between levels. You can quickly use that to keep game to game stats.

More Info on GI:

> **[A new, community-hosted Unreal Engine Wiki](https://forums.unrealengine.com/t/a-new-community-hosted-unreal-engine-wiki/141494)**
>
> After over a year in maintenance mode, the official Unreal Engine Wiki is now permanently offline. These resources now live on a new community-run Unreal Engine Community Wiki — ue4community.wiki! You will be able to find content from the official...

Hope that helps =)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_624ad6e91](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_624ad6e91](https://forums.unrealengine.com/u/anonymous_user_624ad6e91)\
**Post date:** [June 27, 2015, 12:25am UTC](https://forums.unrealengine.com/t/restartgame-keeps-resetting-gamestate-values/323202/3 "2015-06-27T00:25:38Z")

</div>

Man wish I found this a week ago lol, thnx for the quick reply this will fix my problem.
