# Keeping Thread between levels

**URL:** <https://forums.unrealengine.com/t/keeping-thread-between-levels/371368>\
**Category:** World Creation\
**Tags:** unreal-engine, level, CPP, question\
**Created:** [September 23, 2016, 7:41am UTC](https://forums.unrealengine.com/t/keeping-thread-between-levels/371368 "2016-09-23T07:41:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Draykoon](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Draykoon](https://forums.unrealengine.com/u/Draykoon)\
**Post date:** [September 23, 2016, 7:41am UTC](https://forums.unrealengine.com/t/keeping-thread-between-levels/371368/1 "2016-09-23T07:41:30Z")

</div>

Hi,

In the BeguinPlay method of my GameMode i create a thread which connect to a server.  
In this server I store information about the different users.

Now i need to change level but i want to keep those information and the thread running.

Which function do you recommend me.

openLevel() but it destory the gamemode  
ServerTravel() but it also destroy the gameMode  
PrepareMapChange/CommitMapChange it keep the gameMode but all the meshes and actors of the previous level are still alive.

I could store the data in the GameState or something and don’t kill the thread when the gameMode is killed but the BeguinPlay() method will be called an other time.

---

<div class="post-metadata">

**Author:** ![Yata](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Yata](https://forums.unrealengine.com/u/Yata)\
**Post date:** [September 23, 2016, 7:43am UTC](https://forums.unrealengine.com/t/keeping-thread-between-levels/371368/2 "2016-09-23T07:43:21Z")

</div>

Keep it in your GameInstance - that is place for all your global data.

---

<div class="post-metadata">

**Author:** ![FeyDreamers](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@FeyDreamers](https://forums.unrealengine.com/u/FeyDreamers)\
**Post date:** [October 7, 2017, 10:23pm UTC](https://forums.unrealengine.com/t/keeping-thread-between-levels/371368/3 "2017-10-07T22:23:18Z")

</div>

And how to access GameInstance in Blueprint of e.g. game level?

---

<div class="post-metadata">

**Author:** ![smugdev](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/smugdev/32/873294_2.png) [@smugdev](https://forums.unrealengine.com/u/smugdev)\
**Post date:** [October 8, 2017, 12:24pm UTC](https://forums.unrealengine.com/t/keeping-thread-between-levels/371368/4 "2017-10-08T12:24:09Z")

</div>

[There is a node for just that.](https://docs.unrealengine.com/latest/INT/BlueprintAPI/Game/GetGameInstance/index.html)
