# New Wiki, Using Game Instance Class for Inter-Level Persistent Data

**URL:** <https://forums.unrealengine.com/t/new-wiki-using-game-instance-class-for-inter-level-persistent-data/12491>\
**Category:** C++\
**Tags:** unreal-engine\
**Created:** [October 2, 2014, 9:24pm UTC](https://forums.unrealengine.com/t/new-wiki-using-game-instance-class-for-inter-level-persistent-data/12491 "2014-10-02T21:24:47Z")\
**Posts on this page:** 13\
**Page:** 1

<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:** [October 2, 2014, 9:24pm UTC](https://forums.unrealengine.com/t/new-wiki-using-game-instance-class-for-inter-level-persistent-data/12491/1 "2014-10-02T21:24:47Z")

</div>

Dear Community,

I have just published new tutorial on how to use the new Engine feature called the **Game Instance** class!

This is only in the engine as of 4.4, but it is very powerful!

You can use the Game Instance class to store data between level transitions!

So where previously you might have had to save stuff out to config file or use a save object, or write out to binary file, now you can carry data from one level to another using the Game Instance class!

In the example code on the wiki I show you how to count the total number of ticks that have elapsed since your game application window first opens and the first level is loaded! The count keeps rising even after changing levels multiple times!

**You can now store any data you want between levels!**

**Epic Wiki Link**

> **[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 — https://unrealcommunity.wiki/! You will be able to find content from...

````auto

**Sample Code From Wiki**

's the code where I am using a custom Game Instance class to count the number of total ticks that occur in the PC, even across different levels!

```

void ASolusPC::PlayerTick(float DeltaTime)
{
	Super::PlayerTick(DeltaTime);
	
	USolusGameInstance* SGI = Cast<USolusGameInstance>(GetGameInstance());
	if(SGI)
	{ 
		SGI->InterLevelPersistentValue++;
		VShow("Inter level value is now!", SGI->InterLevelPersistentValue);
	}
	
}

```

````

**Essential Tip**

To use a custom Game Instance you need to set your DefaultEngine config file!

```auto

[/Script/EngineSettings.GameMapsSettings]
GameInstanceClass=/Script/Solus.SolusGameInstance

```

Enjoy!

---

<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:** [October 5, 2014, 2:40am UTC](https://forums.unrealengine.com/t/new-wiki-using-game-instance-class-for-inter-level-persistent-data/12491/2 "2014-10-05T02:40:40Z")

</div>

> [@timconwell;158605](#):
>
> @, man you’ve got some excellent stuff. You know, on a side note, I was also looking at GameInstance and getting all sorts of confused, then BAM you post something on the forum about it. Course I’m looking at it and realizing, “Wow, it’s that easy? Seriously?” That was like, perfect timing…

Yes it really is that easy!

Game Instance is great fun!

Thanks Epic!

---

<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:** [October 6, 2014, 4:30am UTC](https://forums.unrealengine.com/t/new-wiki-using-game-instance-class-for-inter-level-persistent-data/12491/3 "2014-10-06T04:30:44Z")

</div>

> [@;158775](#):
>
> Yes it is, I am using a Game Instance for all my persistent data serialization. Serializing the state of all objects between levels. Allowing the world to appear persistent. A lot of fun.

Woohoo!

Great to hear from you !

🙂

---

<div class="post-metadata">

**Author:** ![Overwrite\_Games](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/overwrite_games/32/88710_2.png) [@Overwrite\_Games](https://forums.unrealengine.com/u/Overwrite_Games)\
**Post date:** [October 6, 2014, 3:29pm UTC](https://forums.unrealengine.com/t/new-wiki-using-game-instance-class-for-inter-level-persistent-data/12491/4 "2014-10-06T15:29:14Z")

</div>

Great job ! 😃

---

<div class="post-metadata">

**Author:** ![envenger](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@envenger](https://forums.unrealengine.com/u/envenger)\
**Post date:** [October 6, 2014, 7:39pm UTC](https://forums.unrealengine.com/t/new-wiki-using-game-instance-class-for-inter-level-persistent-data/12491/5 "2014-10-06T19:39:02Z")

</div>

Really helpful. I was searching for something like this since last few days but got nothing [Chaning map(game mode), are the values saved? - C++ Gameplay Programming - Unreal Engine Forums](https://forums.unrealengine.com/showthread.php?47676-Chaning-map%28game-mode%29-are-the-values-saved).

And this is really simple too…

---

<div class="post-metadata">

**Author:** ![Moss](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/moss/32/704032_2.png) [@Moss](https://forums.unrealengine.com/u/Moss)\
**Post date:** [October 7, 2014, 1:16pm UTC](https://forums.unrealengine.com/t/new-wiki-using-game-instance-class-for-inter-level-persistent-data/12491/6 "2014-10-07T13:16:42Z")

</div>

Nice one! With this one and the GameSingleton (through the GameSingletonClassName config value) we have a lot of freedom regarding persistent instances.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_6334e343](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_6334e343](https://forums.unrealengine.com/u/anonymous_user_6334e343)\
**Post date:** [October 8, 2014, 8:13am UTC](https://forums.unrealengine.com/t/new-wiki-using-game-instance-class-for-inter-level-persistent-data/12491/7 "2014-10-08T08:13:39Z")

</div>

Thank you ! 😃

---

<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:** [October 9, 2014, 8:04am UTC](https://forums.unrealengine.com/t/new-wiki-using-game-instance-class-for-inter-level-persistent-data/12491/8 "2014-10-09T08:04:22Z")

</div>

> [@MrNexy;159609](#):
>
> Great job ! 😃

Haha thanks MrNexy, great to hear from you!

🙂

> [@envenger;159739](#):
>
> Really helpful. I was searching for something like this since last few days but got nothing [Chaning map(game mode), are the values saved? - C++ - Epic Developer Community Forums](https://forums.unrealengine.com/showthread.php?47676-Chaning-map%28game-mode%29-are-the-values-saved).
> 
> And this is really simple too…

Hee hee! Glad you like!

> [@Moss;160107](#):
>
> Nice one! With this one and the GameSingleton (through the GameSingletonClassName config value) we have a lot of freedom regarding persistent instances.

Very nice to hear from you Moss! Yea UE4 C++ is so much fun!

> [@;160542](#):
>
> Thank you ! 😃

You’re welcome!

❤

---

<div class="post-metadata">

**Author:** ![Moss](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/moss/32/704032_2.png) [@Moss](https://forums.unrealengine.com/u/Moss)\
**Post date:** [October 9, 2014, 6:36pm UTC](https://forums.unrealengine.com/t/new-wiki-using-game-instance-class-for-inter-level-persistent-data/12491/9 "2014-10-09T18:36:55Z")

</div>

> [@;161055](#):
>
> Very nice to hear from you Moss! Yea UE4 C++ is so much fun!

Thanks dude! Yeah ditching UnrealScript was the best decision ever made 😃 I have been using UE3 for about 8 years and I also tended to implement stuff in native then script, you just get more from the engine.

---

<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:** [October 10, 2014, 4:22am UTC](https://forums.unrealengine.com/t/new-wiki-using-game-instance-class-for-inter-level-persistent-data/12491/10 "2014-10-10T04:22:54Z")

</div>

> [@Moss;161297](#):
>
> Thanks dude! Yeah ditching UnrealScript was the best decision ever made 😃 I have been using UE3 for about 8 years and I also tended to implement stuff in native then script, you just get more from the engine.

Yea I’ve been enjoying your community contributions / general presence!

I can’t wait to see what you come up with in UE4 with full C++ access!

Make sure to let me know when you publish your amazing creations!

---

<div class="post-metadata">

**Author:** ![Moss](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/moss/32/704032_2.png) [@Moss](https://forums.unrealengine.com/u/Moss)\
**Post date:** [October 10, 2014, 11:59am UTC](https://forums.unrealengine.com/t/new-wiki-using-game-instance-class-for-inter-level-persistent-data/12491/11 "2014-10-10T11:59:34Z")

</div>

I have some plugins in the works 😃

---

<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:** [December 17, 2014, 8:33pm UTC](https://forums.unrealengine.com/t/new-wiki-using-game-instance-class-for-inter-level-persistent-data/12491/12 "2014-12-17T20:33:53Z")

</div>

Bumping this for anyone who is not yet familiar with the wonderfulness that is Game Instance class!

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_dfe7b20e1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_dfe7b20e1](https://forums.unrealengine.com/u/anonymous_user_dfe7b20e1)\
**Post date:** [March 25, 2016, 9:04pm UTC](https://forums.unrealengine.com/t/new-wiki-using-game-instance-class-for-inter-level-persistent-data/12491/13 "2016-03-25T21:04:07Z")

</div>

is there a way to get 2 game instances cause i got one bp and on in c++
