# How to load saved character data when moving to another level

**URL:** <https://forums.unrealengine.com/t/how-to-load-saved-character-data-when-moving-to-another-level/1904866>\
**Category:** Blueprint\
**Tags:** unreal-engine, question\
**Created:** [June 16, 2024, 6:39am UTC](https://forums.unrealengine.com/t/how-to-load-saved-character-data-when-moving-to-another-level/1904866 "2024-06-16T06:39:02Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![KMH\_productions](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kmh_productions/32/1191093_2.png) [@KMH\_productions](https://forums.unrealengine.com/u/KMH_productions)\
**Post date:** [June 16, 2024, 6:39am UTC](https://forums.unrealengine.com/t/how-to-load-saved-character-data-when-moving-to-another-level/1904866/1 "2024-06-16T06:39:02Z")

</div>

Hello colleagues, I need your help in solving a seemingly simple but obscure issue. I’m having trouble loading my saves when changing levels …  
I have a structure in which I save my character’s variables (health, equipment, level …), I store it in SaveGame, in GameInstance I created two functions responsible for saving and loading character variables. There are two levels in my game. Level 1 (main menu) and level 2 (game level). These levels have different game modes. When I test saves at level 2 (game level), they work fine, so I concluded that there is no bug in them. The problem occurs when I want to load saves from level 1 (main menu). Every time I load my saves I get the start of a new game.  
I tried:

- initialize the character, then cut it out because I didn’t get the desired effect and got a lot of errors. In the process, I came to the conclusion that it is not very necessary since I have a single-player game;
- I tried to study level streaming, but all the examples that I found were done within the boundaries of one level (the level was simply divided into separate zones);
- Tried to figure out the teleport function, but couldn’t get it to work;  
At the moment my level loading looks like this  
 ![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/4/5/245478138f1a135f52e1299a444b622f53d8b9f2.png)  
Please help, I’m sure the problem can be solved easily, but due to lack of experience I’m at a dead end.

---

<div class="post-metadata">

**Author:** ![Auran131](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Auran131](https://forums.unrealengine.com/u/Auran131)\
**Post date:** [June 16, 2024, 6:54am UTC](https://forums.unrealengine.com/t/how-to-load-saved-character-data-when-moving-to-another-level/1904866/2 "2024-06-16T06:54:18Z")

</div>

we’d need to see more code to have a guess at this one, but for now just test if your Refs are valid

---

<div class="post-metadata">

**Author:** ![KMH\_productions](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kmh_productions/32/1191093_2.png) [@KMH\_productions](https://forums.unrealengine.com/u/KMH_productions)\
**Post date:** [June 18, 2024, 3:58am UTC](https://forums.unrealengine.com/t/how-to-load-saved-character-data-when-moving-to-another-level/1904866/3 "2024-06-18T03:58:43Z")

</div>

Hello [@Auran131](https://dev.epicgames.com/community/api/user_profiles/tab-redirect/about?discourse_username=Auran131), could you please indicate which parts of the code you want to look at?

Now, when I try to load a saved game from the main menu, I get errors (for all variables in the structure), if I load at the game level, then there are no such errors.  
 ![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/c/2/0c29cef2fdb5ad2aa23b1a59bc39bcbf94befc81.png)

The errors refer to “ContinueGame” which is located in the Game instance (here I load the slot and set the values ​​of the character variables from the saved structure)

 ![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/8/b/a8b9f615ca3cc93df4d1f41dd706e1c54e7f52a2.png)

This is how I create a slot in a Game instance

 ![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/b/5/bb5e6004f22e834b90116e5176f33b746acf5c3f.png)

This is how I save a slot in a Game instance

 ![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/b/e/6bebe2410cd8c478b3eb2ab446d73ec39e33b6a6.png)

---

<div class="post-metadata">

**Author:** ![Auran131](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Auran131](https://forums.unrealengine.com/u/Auran131)\
**Post date:** [June 18, 2024, 6:24am UTC](https://forums.unrealengine.com/t/how-to-load-saved-character-data-when-moving-to-another-level/1904866/4 "2024-06-18T06:24:39Z")

</div>

so its telling you something is invalid, but it works in levels.

based on what i can see you’re using GetPlayerCharacter but does the character even exist in a main menu?

---

<div class="post-metadata">

**Author:** ![KMH\_productions](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kmh_productions/32/1191093_2.png) [@KMH\_productions](https://forums.unrealengine.com/u/KMH_productions)\
**Post date:** [June 20, 2024, 2:27am UTC](https://forums.unrealengine.com/t/how-to-load-saved-character-data-when-moving-to-another-level/1904866/5 "2024-06-20T02:27:48Z")

</div>

No, it doesn’t exist in the main menu, since the main menu and the game level have different game mods

---

<div class="post-metadata">

**Author:** ![Auran131](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Auran131](https://forums.unrealengine.com/u/Auran131)\
**Post date:** [June 20, 2024, 2:46am UTC](https://forums.unrealengine.com/t/how-to-load-saved-character-data-when-moving-to-another-level/1904866/6 "2024-06-20T02:46:23Z")

</div>

that’ll be the problem then,

if you only have one player character you can just store its savedatastructure directly in the gameinstance, then on the character begin play you can check if that save data exists and load directly from the gameinstance

---

<div class="post-metadata">

**Author:** ![KMH\_productions](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kmh_productions/32/1191093_2.png) [@KMH\_productions](https://forums.unrealengine.com/u/KMH_productions)\
**Post date:** [June 20, 2024, 3:41am UTC](https://forums.unrealengine.com/t/how-to-load-saved-character-data-when-moving-to-another-level/1904866/7 "2024-06-20T03:41:21Z")

</div>

I was just thinking about this and will try it out right now. I also managed to find information that you cannot change the game mode during execution from the blueprints (not 100% sure, but several threads on the forum indicate this).

---

<div class="post-metadata">

**Author:** ![KMH\_productions](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kmh_productions/32/1191093_2.png) [@KMH\_productions](https://forums.unrealengine.com/u/KMH_productions)\
**Post date:** [June 20, 2024, 6:07am UTC](https://forums.unrealengine.com/t/how-to-load-saved-character-data-when-moving-to-another-level/1904866/8 "2024-06-20T06:07:10Z")

</div>

Found the solution here [I have trouble with load game button in main menu - #5 by ThompsonN13](https://forums.unrealengine.com/t/i-have-trouble-with-load-game-button-in-main-menu/458061/5)  
In short, it’s about loading your saves in a game mod. I did this by using a boolean variable, when I start the game I set it to true, if I continue the game I set it to false. In my game mod, when starting, I check the value of a variable and select the desired branch.

Start a new game from the main menu

 ![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/5/a/85a5766729cf595d7248bb93461691cce5eab746.png)

Continue last saved game from main menu

 ![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/6/5/d656d7fb166145c6b702214ebcc631b5242dfcda.png)

Game loading function

 ![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/6/8/f68d09334d39c099afd59168894ca74811aab685.png)

Game mode on my game level

 ![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/a/a/8aabccb7cbbd94b4b91a2f9090bfddb72b016927.png)

@Auran131, thanks for your help and for giving me the right idea.

---

<div class="post-metadata">

**Author:** ![Auran131](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Auran131](https://forums.unrealengine.com/u/Auran131)\
**Post date:** [June 20, 2024, 6:15am UTC](https://forums.unrealengine.com/t/how-to-load-saved-character-data-when-moving-to-another-level/1904866/9 "2024-06-20T06:15:16Z")

</div>

just be careful with load orders,

if your character doesn’t exist when the GameMode begin play fires it will fail.

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [July 20, 2024, 6:15am UTC](https://forums.unrealengine.com/t/how-to-load-saved-character-data-when-moving-to-another-level/1904866/10 "2024-07-20T06:15:39Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
