# How To Use Game Instance

**URL:** <https://forums.unrealengine.com/t/how-to-use-game-instance/1268130>\
**Category:** Blueprint\
**Tags:** unreal-engine, Blueprint, question\
**Created:** [August 21, 2023, 7:41pm UTC](https://forums.unrealengine.com/t/how-to-use-game-instance/1268130 "2023-08-21T19:41:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![DojaRico](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DojaRico](https://forums.unrealengine.com/u/DojaRico)\
**Post date:** [August 21, 2023, 7:41pm UTC](https://forums.unrealengine.com/t/how-to-use-game-instance/1268130/1 "2023-08-21T19:41:19Z")

</div>

How do I tell my currency to stay between levels. I’ve tried following so many different tutorials and maybe I’m just stupid but I cannot for the life of me get it to work. I’ve tried so many combinations of “set currency” and “cast to game instance” but nothing seems to work. I feel like I’m missing something within the game instance? Any help or insight is much appreciated \<3

 ![BP_TopDownCharacter 8_21_2023 3_32_25 PM](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/1/3/4139183b8613ccf4279b2fcb2ea46a585a615bac.png)  
(Character Blueprint ⬆)  
 ![BP_TopDownCharacter 8_21_2023 3_33_00 PM](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/b/6/eb65aa9957c75383d65aeb5230f6376ab1601120.png)  
(Where The Level Change Happens ⬆)  
 ![BP_TopDownCharacter 8_21_2023 3_32_38 PM](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/8/f/58f60b6293fc5ce48b9379ea98df0ee13b692740.png)  
(Game Instance ⬆)

---

<div class="post-metadata">

**Author:** ![JaredTherriault](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jaredtherriault/32/1194499_2.png) [@JaredTherriault](https://forums.unrealengine.com/u/JaredTherriault)\
**Post date:** [August 21, 2023, 7:51pm UTC](https://forums.unrealengine.com/t/how-to-use-game-instance/1268130/2 "2023-08-21T19:51:53Z")

</div>

So to recap, your Currency variable lives on the character itself? If so, the character is being destroyed along with its data when the new level is loaded. You need to save this either in a save game object so it can be saved and loaded on level load or recreate the variable and events on the GameInstance itself so it can persist between level loads. Then if you haven’t already, make sure you set your project settings to use your BasicGameInstance class, otherwise it will create a generic one at runtime.

---

<div class="post-metadata">

**Author:** ![DojaRico](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DojaRico](https://forums.unrealengine.com/u/DojaRico)\
**Post date:** [August 21, 2023, 8:27pm UTC](https://forums.unrealengine.com/t/how-to-use-game-instance/1268130/3 "2023-08-21T20:27:31Z")

</div>

I’ve Tried putting the same code into my game instance and nothing happened I don’t know how to tell it to reference that. I have it set in my project settings yet the money still resets when the new level is loaded. I’ve also tried the same process with the Save Game Object and that also doesn’t work. I feel like I’m somehow missing the connecting link. The code is in my game instance and now also a save game object but I still can’t figure out how to reference either of them.

---

<div class="post-metadata">

**Author:** ![JaredTherriault](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jaredtherriault/32/1194499_2.png) [@JaredTherriault](https://forums.unrealengine.com/u/JaredTherriault)\
**Post date:** [August 21, 2023, 8:57pm UTC](https://forums.unrealengine.com/t/how-to-use-game-instance/1268130/4 "2023-08-21T20:57:17Z")

</div>

In your character, call GetGameInstance then cast to BasicGameInstance and pull out the resulting pin and find Currency. Use that to Get and Set Currency. Always reference the variable in the GameInstance because that and the one on the character are two separate variables.

This video covers it pretty well: [https://www.youtube.com/watch?app=desktop&v=HpLeyIszAUU](https://www.youtube.com/watch?app=desktop&v=HpLeyIszAUU)
