HomeGamesMusicContact

How To Create A Save System Unreal Engine 4

How To Create A Save System Unreal Engine 4. Learn how to create a saving system for your game in Unreal Engine 4.



Create A New Save Game Blueprint Class

Go to Content Browser, click RMB > select Blueprint Class > under All Classes search and select SaveGame > name the new Blueprint MySaveGame. Next, open the Blueprint MySaveGame, add a new Boolean variables, call it mysave1, compile the Blueprint, make the variable public by clicking the eye next to it in the My Panel > Variables, also, the Default Value needs to be unchecked in the Details Panel, Compile and Save then close the Blueprint.

Save System Examples - Menu and Pick up / Level Completed

Let's say, for example, that your game has a level with Pick up items in it, and the player needs to collect those items in order to finish the level, to save the player progress you can add a saving system to the Pick up item Blueprint. Open the Pick up item Blueprint, in the scripting string of the Blueprint, after you have set a Branch condition, something like the player needs to collect 100 Pick up items, add a Create Save Game Object node, select MySaveGame Blueprint, add a Set mysave1 variable node with the box checked, connect the Return Value pin of Create Save Game Object with the Target pin of Set mysave1 variable node, then add to the string a Save Game to Slot node, the Slot Name set to SaveGame.

Now in the Menu, you can script a saving system to check if the player has collected the Pick up items, and if he did you can reward him/her by unlocking the next level. To do that, in the Event Graph, add to the Event Construct string, a Does Save Game Exist node, then add a Branch node, drag of the False pin, add a Create Save Game Object set it to MySaveGame Blueprint, then add a Save Game to Slot, set the Slot Name to SaveGame, add to the string a Load Game From Slot node, add a Cast To MySaveGame, promote to variable the As MySaveGame pin, call it mysavereference, connect the True pin of the Branch node with the Load Game From Slot node.

Next, you can add to the Menu buttons a lock/unlock system. In the Event Graph, add a ?IsValid node, add a Get mysavereference node and connect it with the Input Object pin of the ?IsValid node, drag of the Get mysavereference pin, add a reference to the mysave1 variable, of it drag to add a Branch node, connect the Is Valid pin of the ?IsValid node with the Branch node. Now, you can connect the entire string with an On Clicked Event of a button of your choice. The True pin of the Branch node you can connect it with an Open Level script, and the False pin with an Animation or something that say's: The Level is Locked.

Edvog on the internet

YoutubeSpotifyAmazon MusicApple MusicGoogle Play MusicGoogle Play

Comments