Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

How do I make a save/load game where If I quit the game and come back and click on Load Game it loads from where I left my character?

So I have a game and I want to make the Save/Load system. Ok so I click start the game from the main menu and in a point of my time i must pause it, in the pause menu i have a button called Save game where i click and if i want to quit the game, after, i click quit game.

When I come back and want to continue from where I left I have a button called Load game in the main menu, and when I click it , I want to load the exact location and the exact level where I saved the game.

How do I do that?

Product Version: UE 4.17
more ▼

asked Oct 04 '18 at 10:19 PM in Blueprint Scripting

avatar image

3 1 1

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first
  1. Create a new Blueprint, based on the Game Save Object class, call it something like MyGameSaver

  2. Add a string variable to the MyGameSaver called "LevelName".

  3. Add a Transform variable to the MyGameSaver called "PlayerTransform". DO THE FOLLOWING STEPS IN YOUR GAMEINSTANCE:

  4. In your Save Game action, have it Create a Save Game Object of your class MyGameSaver, then use the Get Current Level Name node to set the MyGameSaver object you just created's LevelName variable, and use the GetActor Transform node from your player pawn and/or its Controller Rotation to set the MyGameSaver object's PlayerTransform variable.

  5. After that, have it use the Save Game (Or is it Save Game to Slot) node to save your now-populated MyGameSaver object to disk.

  6. In your Load Game action, use the Load Game (or is it Load Game from Slot?) node - remember to use the same string for the save file name - and cast the returned object to your MyGameSaver class, and then you can get the PlayerTransform and LevelName values from there. Use Slot 0 for both save and load. I don't know what slots are for. 0 works for me.

  7. After that, in the Load game action, Set a Transform variable in your GameInstance "PendingPlayerLoadTransform" to the PlayerTransform value from your loaded MyGameSaver object.

  8. After that, having it use the loaded LevelName value, use the Open Level node with the LevelName value as the name of the level to load. NEXT STEP HAPPENS IN THE PAWN OR PLAYERCONTROLLER BUT COULD WORK FROM OTHER PLACES MAYBE:

  9. In your Pawn class on the Possess event or the BeginPlay event, first thing you do is check your GameInstance for whether the PendingPlayerLoadTransform" is set to anything other than 0,0,0 or whatever the default value is. If it is, then Set Actor Transform or Set World Transform on the Pawn to be what that PendingPlayerLoadTransform value is. And if needed set the Player Controller's Control Rotation to match the rotation part of the Transform.

  10. After that have it set your GameInstance's PendingPlayerLoadTransform value back to the default 0,0,0 0,0,0.

I haven't tested this but I think it will work.

more ▼

answered Oct 04 '18 at 10:39 PM

avatar image

3.8k 18 20 20

avatar image Synnapse Oct 05 '18 at 09:52 AM

Hello mightyenigma and thank you for your answer I'll try this method right now and I'll tell you if it worked or not!

avatar image Synnapse Oct 05 '18 at 10:57 AM

What do you mean with "Save game action" ???

avatar image mightyenigma Nov 22 '18 at 04:00 AM

I mean whatever piece of code you create to make the saving of the game happen like maybe a UI button click event or a function in a playercontroller or maybe a trigger volume overlap event in a level blueprint. Whatever you have done to cause it to save the game.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

I have th same question and i have solve it with this : https://www.youtube.com/watch?v=L61D2713JIM&ab_channel=Vintz

more ▼

answered Jun 12 '19 at 02:10 PM

avatar image

1 1

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question