Need help with saving and loading the position of the player

Hello erveryone,

for quite some time I’m working on a endless runner game like the one created in the ue 4 tutorial series
Endless Runner with Blueprints Everything went fine so far until I stumbled upon the problem how to save and load the players position. So I wanted to implement that when the player stops playing the game and he is going to play again he could carry on at the position where he stopped by pressing a button in a menu created with a widget blueprint. So I have watched several tutorials, but in most cases it was only shown how to save some integers to print some numbers at the end and unfortunately I wasn’t able to assign it to get my player position. Eventually I found that usefull video Unreal Engine 4 Tutorials Gameplay Logic through which I was able to save the position of the player and load it by pressing any key (in my case Tab) on the keyboard or mouse. But as I mentioned before I wanted to get that player position through pressing a button in a menu to resume the game, but somehow I’m not able to get that working.

All in all I’m relatively new to working with blueprints and the problem with saving and loading data got me going nuts, so I hope someone could explain me how to get that nasty player position so I can implement it to my menu.
Thanks in advance

This is a very easy task. I’ll post you an example when I get in front of my pc (on he phone right now). Woul you prefer a UMG example?

Oh that would be rly awesome. Yes it would be great if it would be able to access it through a UMG bp since I made my menu with UMG, too

Ok, I’m assuming you created your custom save object etc., right?

yes I did

should i show you my blueprints?

No need. I’ll just do it very quickly.

I created two buttons called Save Button and Load Button inside the UMG editor.

Here are the screenshots. They are pretty self-explanatory, but let me know if you have more questions.

.

thanks for your quick respone. I have one question. Did you set up the vector variable “position” inside bp save game or did you create it in third person character? I made the variable in save game bp, but i cannot connect “cast to thirdpersoncharacter” with the variable position.

thanks for your quick respone. I have one question. Did you set up the vector variable “position” inside bp save game or did you create it in third person character? I made the variable in save game bp, but i cannot connect “cast to thirdpersoncharacter” with the variable position.

I created the “position” variable both for the save game and the thirdprsoncharacter. It does not ncessarily have to be created for the character though, you can just get its location via the get actor location node. Depends on how you feel like doşng it actually…

Now with get actor location node everything works fine, thanks to you :slight_smile:

Cheers, glad that worked. Would you mind accepting/upvoting the answer so it shows as resolved? Thx

Sure, did it

Alperenakyuz, how did you create that “Target → Position” node?

Hi;

How did you create that “Target → Position” node?

Thanks.

“How did you create that “Target → Position” node?”

I wish to know this too.

Oh I see. The variable is in the character blueprint. Thanks mate, I learned something new today! :slight_smile:

In the “PositionSave” blueprint, he created a Vector variable called Position. Then from then cast you need to type:

“get Position”

This will give you the node you want.