<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ue5 save and load Archives - Couch Learn</title>
	<atom:link href="https://couchlearn.com/tag/ue5-save-and-load/feed/" rel="self" type="application/rss+xml" />
	<link>https://couchlearn.com/tag/ue5-save-and-load/</link>
	<description>Detailed Game Programming Tutorials</description>
	<lastBuildDate>Fri, 30 Dec 2022 21:52:38 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.5</generator>

<image>
	<url>https://couchlearn.com/wp-content/uploads/2020/05/cropped-logolarge-32x32.png</url>
	<title>ue5 save and load Archives - Couch Learn</title>
	<link>https://couchlearn.com/tag/ue5-save-and-load/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How to Save and Load in Unreal Engine 5</title>
		<link>https://couchlearn.com/how-to-save-and-load-in-unreal-engine-5/</link>
					<comments>https://couchlearn.com/how-to-save-and-load-in-unreal-engine-5/#comments</comments>
		
		<dc:creator><![CDATA[Matt]]></dc:creator>
		<pubDate>Thu, 22 Dec 2022 22:05:22 +0000</pubDate>
				<category><![CDATA[Medium Difficulty]]></category>
		<category><![CDATA[Unreal Engine]]></category>
		<category><![CDATA[Unreal Engine 4]]></category>
		<category><![CDATA[Unreal Engine 5]]></category>
		<category><![CDATA[medium]]></category>
		<category><![CDATA[save and load]]></category>
		<category><![CDATA[save game]]></category>
		<category><![CDATA[savegame]]></category>
		<category><![CDATA[saving and load]]></category>
		<category><![CDATA[saving and loading]]></category>
		<category><![CDATA[ue4]]></category>
		<category><![CDATA[ue4 save and load]]></category>
		<category><![CDATA[ue5]]></category>
		<category><![CDATA[ue5 save and load]]></category>
		<category><![CDATA[unreal engine]]></category>
		<category><![CDATA[unreal engine 4]]></category>
		<category><![CDATA[unreal engine 5]]></category>
		<category><![CDATA[unreal engine 5 save and load]]></category>
		<category><![CDATA[unreal engine save and load]]></category>
		<guid isPermaLink="false">https://couchlearn.com/?p=1946</guid>

					<description><![CDATA[<p>Saving and loading of game data is a essential part of every modern game. Luckily for you, Unreal Engine has a built in SaveGame system <a class="mh-excerpt-more" href="https://couchlearn.com/how-to-save-and-load-in-unreal-engine-5/" title="How to Save and Load in Unreal Engine 5">[...]</a></p>
<p>The post <a href="https://couchlearn.com/how-to-save-and-load-in-unreal-engine-5/">How to Save and Load in Unreal Engine 5</a> appeared first on <a href="https://couchlearn.com">Couch Learn</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Saving and loading of game data is a essential part of every modern game. Luckily for you, Unreal Engine has a built in SaveGame system that allows easy saving and loading of your game data to a file. All data saved to this file can be loaded easily with only a few functions!<br><br>In this guide you will learn how to Save and Load in Unreal Engine 5.</p>



<h2 class="wp-block-heading">Prerequisites</h2>



<p>To follow this guide you need to understand the basics of Unreal Engine, working with blueprints inside the editor and using a custom Game Instance. We have linked guides below to these topics.<br><a href="https://docs.unrealengine.com/4.27/en-US/ProgrammingAndScripting/Blueprints/BP_HowTo/BasicUsage/" target="_blank" rel="noreferrer noopener">The basics of blueprint actors.<br></a><a href="https://docs.unrealengine.com/4.26/en-US/ProgrammingAndScripting/Blueprints/UserGuide/Variables/" target="_blank" rel="noreferrer noopener">Adding variables to blueprint actors</a>.<br><a href="https://couchlearn.com/how-to-use-the-game-instance-in-unreal-engine-4/" target="_blank" rel="noreferrer noopener">How to use custom Game Instances.</a><br><a href="https://couchlearn.com/how-to-use-custom-events-in-unreal-engine-4/" target="_blank" rel="noreferrer noopener">Custom Events in Unreal Engine.<br></a><br>It would also be beneficial to understand how Input Actions work in Unreal Engine:<br><a href="https://couchlearn.com/how-to-use-input-actions-and-input-axis-mappings-in-your-unreal-engine-4-game/" target="_blank" rel="noreferrer noopener">Click here to learn how to use input actions and axis.</a></p>



<h2 class="wp-block-heading">How it Works</h2>



<p>SaveGame is a class in Unreal Engine that is preconfigured to save and load the data contained in the variables you add.<br><br>The variables you set are then saved to a file stored on the user&#8217;s machine. This is then read and the variables can be accessed in your game.<br><br>The save file is located in these locations:<br>Windows: Local Appdata folder<br>MacOS: Library/Application Support<br>Linux: /home/username/.local/share<br><br><strong>Almost every variable type can be saved and loaded using the SaveGame class.</strong></p>



<h2 class="wp-block-heading">Creating our Save Class</h2>



<p>Firstly, create a new blueprint class from the content drawer.</p>



<figure class="wp-block-image size-full"><img fetchpriority="high" decoding="async" width="953" height="893" src="https://couchlearn.com/wp-content/uploads/2022/12/image-22.png" alt="Creating the blueprint class from the content drawer" class="wp-image-1949" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-22.png 953w, https://couchlearn.com/wp-content/uploads/2022/12/image-22-300x281.png 300w, https://couchlearn.com/wp-content/uploads/2022/12/image-22-768x720.png 768w" sizes="(max-width: 953px) 100vw, 953px" /></figure>



<p>Next, in the popup window, click the drop down arrow at the bottom. In the search bar type &#8220;SaveGame&#8221; and click the option from the list.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="626" height="555" src="https://couchlearn.com/wp-content/uploads/2022/12/image-23.png" alt="Creating the SaveGame blueprint class." class="wp-image-1950" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-23.png 626w, https://couchlearn.com/wp-content/uploads/2022/12/image-23-300x266.png 300w" sizes="(max-width: 626px) 100vw, 626px" /></figure>



<p>Then, give your new SaveGame blueprint a suitable name. We need to remember this as it is used later. In our case, we used the name DemoSaveGame.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="381" height="343" src="https://couchlearn.com/wp-content/uploads/2022/12/image-24.png" alt="Naming our SaveGame blueprint &quot;DemoSaveGame&quot;." class="wp-image-1951" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-24.png 381w, https://couchlearn.com/wp-content/uploads/2022/12/image-24-300x270.png 300w" sizes="(max-width: 381px) 100vw, 381px" /></figure>



<h3 class="wp-block-heading">Saving the variables</h3>



<p>Now that your SaveGame class has been created, you can add any variables you need for your project.<br><br>For this demo we create a new <em>Vector</em> variable called &#8220;PlayerPosition&#8221;.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="682" height="444" src="https://couchlearn.com/wp-content/uploads/2022/12/image-25.png" alt="Creating a new Vector variable named PlayerPosition in the DemoSaveGame blueprint class." class="wp-image-1952" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-25.png 682w, https://couchlearn.com/wp-content/uploads/2022/12/image-25-300x195.png 300w" sizes="(max-width: 682px) 100vw, 682px" /></figure>



<p>Once you have created the variables you need for your project, click Compile and Save to ensure your changes are applied and saved.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="387" height="237" src="https://couchlearn.com/wp-content/uploads/2022/12/image-26.png" alt="Compiling and saving the previous changes." class="wp-image-1954" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-26.png 387w, https://couchlearn.com/wp-content/uploads/2022/12/image-26-300x184.png 300w" sizes="(max-width: 387px) 100vw, 387px" /></figure>



<h2 class="wp-block-heading">Adding Save and Load Functionality</h2>



<p>Firstly, in our <strong><em><a href="http://couchlearn.com/how-to-use-the-game-instance-in-unreal-engine-4/(opens in a new tab)" target="_blank" rel="noreferrer noopener">Game Instance</a></em></strong>, add two new custom events. &#8220;Save&#8221; and &#8220;Load&#8221;.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="213" height="256" src="https://couchlearn.com/wp-content/uploads/2022/12/image-27.png" alt="Creating two new events in the Game Instance. &quot;Save&quot; and &quot;Load&quot;" class="wp-image-1958"/></figure>



<p>We also need to add a new variable on the <strong><em>Game Instance</em></strong>. Name this variable SaveGame and set the type to the class you created in the previous step.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="637" height="387" src="https://couchlearn.com/wp-content/uploads/2022/12/image-33.png" alt="Creating a variable to store the SaveGame object." class="wp-image-1968" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-33.png 637w, https://couchlearn.com/wp-content/uploads/2022/12/image-33-300x182.png 300w" sizes="(max-width: 637px) 100vw, 637px" /></figure>



<h3 class="wp-block-heading">Loading our Variables from the Save File</h3>



<p>Now that our Game Instance is setup, on the Load event, create a new &#8220;Does Save Game Exist&#8221; node. The &#8220;Slot Name&#8221; pin needs to be given a name. This can be set to anything you want. Each different name you use saves to a different file.<br><br>In our case we just named this &#8220;savegame&#8221;.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="514" height="209" src="https://couchlearn.com/wp-content/uploads/2022/12/image-29.png" alt="Creating the Does Save Game Exist node on our Load Event." class="wp-image-1962" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-29.png 514w, https://couchlearn.com/wp-content/uploads/2022/12/image-29-300x122.png 300w" sizes="(max-width: 514px) 100vw, 514px" /></figure>



<p>Next, add a branch to the output pin of the &#8220;Does Save Game Exist&#8221; node. This will branch if our save file exists or not.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="701" height="192" src="https://couchlearn.com/wp-content/uploads/2022/12/image-30.png" alt="Creating a branch node from the Does Save Game Exist node." class="wp-image-1963" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-30.png 701w, https://couchlearn.com/wp-content/uploads/2022/12/image-30-300x82.png 300w" sizes="(max-width: 701px) 100vw, 701px" /></figure>



<h4 class="wp-block-heading">If the Save File Exists</h4>



<p>From the &#8220;True&#8221; pin, create a new &#8220;Load Game From Slot&#8221; node with the same &#8220;Slot Name&#8221; as before.</p>



<figure class="wp-block-image size-full is-resized"><img decoding="async" src="https://couchlearn.com/wp-content/uploads/2022/12/image-31.png" alt="Creating the Load Game From Slot node from the Branch node." class="wp-image-1964" width="840" height="152" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-31.png 1016w, https://couchlearn.com/wp-content/uploads/2022/12/image-31-300x55.png 300w, https://couchlearn.com/wp-content/uploads/2022/12/image-31-768x140.png 768w" sizes="(max-width: 840px) 100vw, 840px" /></figure>



<p>Next, from the blue output pin, create a &#8220;Cast to&#8221; node. This should cast to the class you created in the first step. For us this is &#8220;Cast to DemoSaveGame&#8221;.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="889" height="176" src="https://couchlearn.com/wp-content/uploads/2022/12/image-32.png" alt="Creating the Cast to DemoSaveGame node from the Load Game from Slot blue output pin." class="wp-image-1965" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-32.png 889w, https://couchlearn.com/wp-content/uploads/2022/12/image-32-300x59.png 300w, https://couchlearn.com/wp-content/uploads/2022/12/image-32-768x152.png 768w" sizes="(max-width: 889px) 100vw, 889px" /></figure>



<p>Then set the Game Instance&#8217;s Save Game variable we created earlier to the output of the &#8220;Cast to&#8221; node.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="893" height="219" src="https://couchlearn.com/wp-content/uploads/2022/12/image-34.png" alt="Setting the SaveGame object variable to the output of the Cast to DemoSaveGame node." class="wp-image-1970" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-34.png 893w, https://couchlearn.com/wp-content/uploads/2022/12/image-34-300x74.png 300w, https://couchlearn.com/wp-content/uploads/2022/12/image-34-768x188.png 768w" sizes="(max-width: 893px) 100vw, 893px" /></figure>



<p>From there, we create a &#8220;Set Actor Location&#8221; node. This will be used to move our character to the saved location.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="841" height="407" src="https://couchlearn.com/wp-content/uploads/2022/12/image-35.png" alt="Creating a Set Actor Location node from the Set Save Game node." class="wp-image-1972" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-35.png 841w, https://couchlearn.com/wp-content/uploads/2022/12/image-35-300x145.png 300w, https://couchlearn.com/wp-content/uploads/2022/12/image-35-768x372.png 768w" sizes="(max-width: 841px) 100vw, 841px" /></figure>



<p>From the variables list on the left of the editor, drag the &#8220;SaveGame&#8221; variable and drop near the the nodes. This will show a list of options. Click the &#8220;Get SaveGame&#8221; option to allow us easy access to this variable for the next few steps.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="329" src="https://couchlearn.com/wp-content/uploads/2022/12/image-41-1024x329.png" alt="Creating a Get Save Game node from the SaveGame variable." class="wp-image-1980" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-41-1024x329.png 1024w, https://couchlearn.com/wp-content/uploads/2022/12/image-41-300x96.png 300w, https://couchlearn.com/wp-content/uploads/2022/12/image-41-768x247.png 768w, https://couchlearn.com/wp-content/uploads/2022/12/image-41.png 1297w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>Dragging from the &#8220;Save Game&#8221; blue pin then typing &#8220;get player position&#8221;, we can see our &#8220;Player Position&#8221; Vector variable that we created earlier. Click this option in the list to add it to the blueprint graph.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="1013" height="329" src="https://couchlearn.com/wp-content/uploads/2022/12/image-42.png" alt="Getting the PlayerPosition variable from the SaveGame class." class="wp-image-1981" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-42.png 1013w, https://couchlearn.com/wp-content/uploads/2022/12/image-42-300x97.png 300w, https://couchlearn.com/wp-content/uploads/2022/12/image-42-768x249.png 768w" sizes="(max-width: 1013px) 100vw, 1013px" /></figure>



<p>Next, connect the &#8220;Player Position&#8221; vector pin to the &#8220;New Location&#8221; option on the &#8220;Set Actor Location&#8221; node.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="940" height="291" src="https://couchlearn.com/wp-content/uploads/2022/12/image-43.png" alt="Setting the Actor Location to the Player Position value." class="wp-image-1982" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-43.png 940w, https://couchlearn.com/wp-content/uploads/2022/12/image-43-300x93.png 300w, https://couchlearn.com/wp-content/uploads/2022/12/image-43-768x238.png 768w" sizes="(max-width: 940px) 100vw, 940px" /></figure>



<p>Lastly, create a &#8220;Get Player Character&#8221; node and connect this to the &#8220;Target&#8221; pin of the &#8220;Set Actor Location&#8221; node. This now gets our saved player position and moves the player character to it.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="988" height="312" src="https://couchlearn.com/wp-content/uploads/2022/12/image-44.png" alt="Creating a Get Player Character variable and assigning the output pin to the Set Actor Location Target pin." class="wp-image-1983" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-44.png 988w, https://couchlearn.com/wp-content/uploads/2022/12/image-44-300x95.png 300w, https://couchlearn.com/wp-content/uploads/2022/12/image-44-768x243.png 768w" sizes="(max-width: 988px) 100vw, 988px" /></figure>



<h4 class="wp-block-heading">If the Save File doesn&#8217;t Exist</h4>



<p>If the save file does not exist then we need to create a new file. From the &#8220;False&#8221; pin create a new &#8220;Create Save Game Object&#8221; node. Then set the &#8220;Save Game Class&#8221; purple pin to the custom SaveGame class we created earlier.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="998" height="390" src="https://couchlearn.com/wp-content/uploads/2022/12/image-40.png" alt="Creating a Save Game Object from the false pin on the branch node." class="wp-image-1978" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-40.png 998w, https://couchlearn.com/wp-content/uploads/2022/12/image-40-300x117.png 300w, https://couchlearn.com/wp-content/uploads/2022/12/image-40-768x300.png 768w" sizes="(max-width: 998px) 100vw, 998px" /></figure>



<p>Then, set the Game Instance &#8220;Save Game&#8221; variable to the blue output pin value.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="859" height="345" src="https://couchlearn.com/wp-content/uploads/2022/12/image-45.png" alt="Setting the SaveGame variable to the return value of the Create Save Game Object node." class="wp-image-1984" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-45.png 859w, https://couchlearn.com/wp-content/uploads/2022/12/image-45-300x120.png 300w, https://couchlearn.com/wp-content/uploads/2022/12/image-45-768x308.png 768w" sizes="(max-width: 859px) 100vw, 859px" /></figure>



<p>Lastly, connect the &#8220;Set Save Game&#8221; node to the blueprint nodes above. This can be done by double clicking the white lines to create points. <br><br>Connect the blueprints nodes together as shown in the image below.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="974" height="372" src="https://couchlearn.com/wp-content/uploads/2022/12/image-46.png" alt="Cleaning the blueprints for easy reading." class="wp-image-1985" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-46.png 974w, https://couchlearn.com/wp-content/uploads/2022/12/image-46-300x115.png 300w, https://couchlearn.com/wp-content/uploads/2022/12/image-46-768x293.png 768w" sizes="(max-width: 974px) 100vw, 974px" /></figure>



<h3 class="wp-block-heading">Saving our Variables to the Save File</h3>



<p>Now that we can load saved variables, we need to save the variables!<br><br>Firstly, drag and drop the SaveGame variable and click &#8220;Get SaveGame&#8221; next to the Save event.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="883" height="369" src="https://couchlearn.com/wp-content/uploads/2022/12/image-47.png" alt="Getting the value of the SaveGame variable." class="wp-image-1987" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-47.png 883w, https://couchlearn.com/wp-content/uploads/2022/12/image-47-300x125.png 300w, https://couchlearn.com/wp-content/uploads/2022/12/image-47-768x321.png 768w" sizes="(max-width: 883px) 100vw, 883px" /></figure>



<p>From there, we create an &#8220;? Is Valid&#8221; node. This allows us to branch the code if our save file has been loaded or not.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="637" height="281" src="https://couchlearn.com/wp-content/uploads/2022/12/image-51.png" alt="Creating an Is Valid node connect to the SaveGame variable value." class="wp-image-1992" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-51.png 637w, https://couchlearn.com/wp-content/uploads/2022/12/image-51-300x132.png 300w" sizes="(max-width: 637px) 100vw, 637px" /></figure>



<h4 class="wp-block-heading">If the Save File is Valid</h4>



<p>From our &#8220;Save Game&#8221; blue variable, create a &#8220;Set Player Position&#8221; node and connect it to the &#8220;Is Valid&#8221; pin.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="637" height="299" src="https://couchlearn.com/wp-content/uploads/2022/12/image-52.png" alt="Setting the Player Position variable if the SaveGame object reference is valid." class="wp-image-1993" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-52.png 637w, https://couchlearn.com/wp-content/uploads/2022/12/image-52-300x141.png 300w" sizes="(max-width: 637px) 100vw, 637px" /></figure>



<p>Next, create a &#8220;Get Player Character&#8221; node and from the blue output pin, create a &#8220;Get Actor Location&#8221; pin.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="741" height="353" src="https://couchlearn.com/wp-content/uploads/2022/12/image-53.png" alt="Creating a get player character node and getting the actor location." class="wp-image-1994" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-53.png 741w, https://couchlearn.com/wp-content/uploads/2022/12/image-53-300x143.png 300w" sizes="(max-width: 741px) 100vw, 741px" /></figure>



<p>Lastly, connect the yellow output pin of the &#8220;Get Actor Location&#8221; node to the yellow input pin on the &#8220;Set Player Position&#8221; node. Now if our save game object is valid we will save the player character location to the save file on disk.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="658" height="307" src="https://couchlearn.com/wp-content/uploads/2022/12/image-54.png" alt="Connecting the Get Actor Location output value to the Set Player Position node." class="wp-image-1995" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-54.png 658w, https://couchlearn.com/wp-content/uploads/2022/12/image-54-300x140.png 300w" sizes="(max-width: 658px) 100vw, 658px" /></figure>



<h4 class="wp-block-heading">If the Save File is not Valid</h4>



<p>If the save game object isn&#8217;t valid, we need to create it before saving any data.<br><br>Firstly, create a &#8220;Create Save Game Object&#8221; node, set the purple input value to our previously created save game class, then connect this to the &#8220;Is Not Valid&#8221; pin as shown below.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="831" height="324" src="https://couchlearn.com/wp-content/uploads/2022/12/image-55.png" alt="Creating a Create Save Game Object node from the Is Not Valid pin." class="wp-image-1996" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-55.png 831w, https://couchlearn.com/wp-content/uploads/2022/12/image-55-300x117.png 300w, https://couchlearn.com/wp-content/uploads/2022/12/image-55-768x299.png 768w" sizes="(max-width: 831px) 100vw, 831px" /></figure>



<p>Next, set the Game Instance SaveGame variable to the blue output pin of the &#8220;Create Save Game Object&#8221; node.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="347" src="https://couchlearn.com/wp-content/uploads/2022/12/image-56-1024x347.png" alt="Setting the Save Game value to the output of the Create Save Game Object node." class="wp-image-1997" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-56-1024x347.png 1024w, https://couchlearn.com/wp-content/uploads/2022/12/image-56-300x102.png 300w, https://couchlearn.com/wp-content/uploads/2022/12/image-56-768x260.png 768w, https://couchlearn.com/wp-content/uploads/2022/12/image-56.png 1059w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>Then, connect the &#8220;Set Save Game&#8221; node to the &#8220;Set Player Position&#8221; node as shown below. This will save the player character&#8217;s position after the &#8220;Save Game&#8221; object is valid.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="272" src="https://couchlearn.com/wp-content/uploads/2022/12/image-57-1024x272.png" alt="Connecting the Set SaveGame node to the other blueprints and cleaning them up." class="wp-image-1998" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-57-1024x272.png 1024w, https://couchlearn.com/wp-content/uploads/2022/12/image-57-300x80.png 300w, https://couchlearn.com/wp-content/uploads/2022/12/image-57-768x204.png 768w, https://couchlearn.com/wp-content/uploads/2022/12/image-57.png 1057w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>Finally, create either a &#8220;Save Game to Slot&#8221; or &#8220;Async Save Game to Slot&#8221; node from the blue SaveGame variable.<br><br><strong><em>If your game needs to save lots of information, use the &#8220;Async Save Game to Slot&#8221; node.<br></em></strong><br><strong><em>If your game only saves a small amount of data, use the &#8220;Save Game to Slot&#8221; node.</em></strong></p>



<figure class="wp-block-image size-full"><img decoding="async" width="851" height="249" src="https://couchlearn.com/wp-content/uploads/2022/12/image-62.png" alt="Creating a Save the Game to Slot node from the SaveGame variable." class="wp-image-2003" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-62.png 851w, https://couchlearn.com/wp-content/uploads/2022/12/image-62-300x88.png 300w, https://couchlearn.com/wp-content/uploads/2022/12/image-62-768x225.png 768w" sizes="(max-width: 851px) 100vw, 851px" /></figure>



<p>Make sure to set the &#8220;Slot Name&#8221; variable to the name you used earlier. In our case this was &#8220;savegame&#8221;.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="637" height="303" src="https://couchlearn.com/wp-content/uploads/2022/12/image-63.png" alt="Saving the game to the savegame slot." class="wp-image-2004" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-63.png 637w, https://couchlearn.com/wp-content/uploads/2022/12/image-63-300x143.png 300w" sizes="(max-width: 637px) 100vw, 637px" /></figure>



<h2 class="wp-block-heading">Saving and Loading the Player Position</h2>



<p>Now that your Save and Load system is complete, we need to trigger this functionality.</p>



<p>In your Player Character class add an Key Press Event. For this guide we used the number 1 key from our ThirdPersonCharacterBP class.<br><br>From there, create a &#8220;Get Game Instance&#8221; node and a &#8220;Cast To&#8221; node to your custom game instance. Connect the two as shown below.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="507" height="232" src="https://couchlearn.com/wp-content/uploads/2022/12/image-58.png" alt="Casting to the GameInstance from the Number 1 Key event" class="wp-image-1999" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-58.png 507w, https://couchlearn.com/wp-content/uploads/2022/12/image-58-300x137.png 300w" sizes="(max-width: 507px) 100vw, 507px" /></figure>



<p>Next, from the blue &#8220;As Game Instance&#8221; pin, call the &#8220;Save&#8221; event we created earlier. Now when we press the number 1 key, our game will save the current player character&#8217;s position to the save file.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="935" height="279" src="https://couchlearn.com/wp-content/uploads/2022/12/image-59.png" alt="Calling the Save event from the Number 1 Key event Cast to Game Instance nodes." class="wp-image-2000" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-59.png 935w, https://couchlearn.com/wp-content/uploads/2022/12/image-59-300x90.png 300w, https://couchlearn.com/wp-content/uploads/2022/12/image-59-768x229.png 768w" sizes="(max-width: 935px) 100vw, 935px" /></figure>



<p>Repeat the previous step for the number 2 key as shown in the image below.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="515" height="223" src="https://couchlearn.com/wp-content/uploads/2022/12/image-60.png" alt="Repeating the previous nodes for the Number 2 Key event" class="wp-image-2001" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-60.png 515w, https://couchlearn.com/wp-content/uploads/2022/12/image-60-300x130.png 300w" sizes="(max-width: 515px) 100vw, 515px" /></figure>



<p>Finally, call the &#8220;Load&#8221; event from the &#8220;As Game Instance&#8221; blue pin. This will now load our saved player position from the save file and teleport our player to that position.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="737" height="223" src="https://couchlearn.com/wp-content/uploads/2022/12/image-61.png" alt="Calling the Load event from the Number 2 Key Cast to Game Instance nodes." class="wp-image-2002" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-61.png 737w, https://couchlearn.com/wp-content/uploads/2022/12/image-61-300x91.png 300w" sizes="(max-width: 737px) 100vw, 737px" /></figure>



<h2 class="wp-block-heading">Demo</h2>



<figure class="wp-block-image size-full"><img decoding="async" width="800" height="449" src="https://couchlearn.com/wp-content/uploads/2022/12/SaveAndLoadDemo.webp" alt="The player character saving and loading the location to and from the save file affecting the gameplay." class="wp-image-2006"/></figure>



<h2 class="wp-block-heading">Download the Project Files</h2>



<script src="https://gumroad.com/js/gumroad-embed.js"></script>
<div class="gumroad-product-embed"><a href="https://gumroad.com/l/jwouk">Loading&#8230;</a></div>



<h2 class="wp-block-heading">Conclusion</h2>



<p>Now your project has saving and loading capabilities!<br><br>This is a very basic implementation but allows you to expand this further. Any data you want to save and load can be implemented into the events we created during this guide. <br><br>An example of this would be the player&#8217;s health. This variable could be created on the SaveGame, saved and loaded onto the character with minimal setup.<br><br>Further Reading:<br><a href="https://docs.unrealengine.com/4.26/en-US/InteractiveExperiences/SaveGame/#:~:text=Creating%20a%20SaveGame%20Object&amp;text=When%20the%20Pick%20Parent%20Class,you%20would%20like%20to%20save." target="_blank" rel="noreferrer noopener">Official UE4/5 documentation for the Saving and Loading in the engine.</a><br><a href="https://www.tomlooman.com/unreal-engine-cpp-save-system/" target="_blank" rel="noreferrer noopener">Tom Looman&#8217;s great guide for implementing Saving and Loading for C++ classes</a></p>
<p>The post <a href="https://couchlearn.com/how-to-save-and-load-in-unreal-engine-5/">How to Save and Load in Unreal Engine 5</a> appeared first on <a href="https://couchlearn.com">Couch Learn</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://couchlearn.com/how-to-save-and-load-in-unreal-engine-5/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/

Page Caching using Disk: Enhanced 
Minified using Disk

Served from: couchlearn.com @ 2026-04-07 00:00:40 by W3 Total Cache
-->