<?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>unreal engine 4 struct Archives - Couch Learn</title>
	<atom:link href="https://couchlearn.com/tag/unreal-engine-4-struct/feed/" rel="self" type="application/rss+xml" />
	<link>https://couchlearn.com/tag/unreal-engine-4-struct/</link>
	<description>Detailed Game Programming Tutorials</description>
	<lastBuildDate>Sat, 25 Jan 2025 17:34:10 +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>unreal engine 4 struct Archives - Couch Learn</title>
	<link>https://couchlearn.com/tag/unreal-engine-4-struct/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How to use Structs in Unreal Engine 4</title>
		<link>https://couchlearn.com/how-to-use-structs-in-unreal-engine-4/</link>
					<comments>https://couchlearn.com/how-to-use-structs-in-unreal-engine-4/#comments</comments>
		
		<dc:creator><![CDATA[Matt]]></dc:creator>
		<pubDate>Sun, 20 Oct 2019 15:24:44 +0000</pubDate>
				<category><![CDATA[Easy Difficulty]]></category>
		<category><![CDATA[UE4 Basics]]></category>
		<category><![CDATA[Unreal Basics]]></category>
		<category><![CDATA[Unreal Engine]]></category>
		<category><![CDATA[ue4 basics]]></category>
		<category><![CDATA[ue4 blueprints]]></category>
		<category><![CDATA[ue4 struct]]></category>
		<category><![CDATA[ue4 structs]]></category>
		<category><![CDATA[ue4 structures]]></category>
		<category><![CDATA[unreal engine 4]]></category>
		<category><![CDATA[unreal engine 4 struct]]></category>
		<category><![CDATA[unreal engine 4 structures]]></category>
		<guid isPermaLink="false">https://couchlearn.com/?p=785</guid>

					<description><![CDATA[<p>Structures are useful for most aspects of Game Development as they are incredibly versatile. In UE4 this is no different. When we are finished, our <a class="mh-excerpt-more" href="https://couchlearn.com/how-to-use-structs-in-unreal-engine-4/" title="How to use Structs in Unreal Engine 4">[...]</a></p>
<p>The post <a href="https://couchlearn.com/how-to-use-structs-in-unreal-engine-4/">How to use Structs in Unreal Engine 4</a> appeared first on <a href="https://couchlearn.com">Couch Learn</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Structures are useful for most aspects of Game Development as they are incredibly versatile. In UE4 this is no different.</p>



<p>When we are finished, our FPS example template character will print the ammo after shooting an will remove one ammo after every shot.</p>



<h3 class="wp-block-heading">What is a Structure (Struct)</h3>



<p>In Unreal Engine 4, the struct is an <strong>easy way to create your own variable type</strong>, giving you the ability to substantially improve the organisation and access of the data in your blueprints.<br><br>One example of using a struct in your UE4 game would be to have a single struct that contains your player&#8217;s position, health, ammo and lives. <br>This then can be saved and loaded as one variable therefore streamlining the process as your game gets more complicated.</p>



<p>In this guide we will be learning how to create a structure and how to use structures in Unreal Engine 4.</p>



<h3 class="wp-block-heading">Creating the Struct</h3>



<p>To create your struct, firstly right click in the content browser and in the bottom section click on the Blueprints tab.</p>



<figure class="wp-block-image"><img decoding="async" width="149" height="308" src="https://couchlearn.com/wp-content/uploads/2019/10/image-23.png" alt="Advanced asset menu" class="wp-image-861" srcset="https://couchlearn.com/wp-content/uploads/2019/10/image-23.png 149w, https://couchlearn.com/wp-content/uploads/2019/10/image-23-145x300.png 145w" sizes="(max-width: 149px) 100vw, 149px" /></figure>



<p>Once in the Blueprints tab, find and click on the option named Struct.</p>



<figure class="wp-block-image"><img fetchpriority="high" decoding="async" width="345" height="342" src="https://couchlearn.com/wp-content/uploads/2019/10/image-22.png" alt="Creating the struct" class="wp-image-860" srcset="https://couchlearn.com/wp-content/uploads/2019/10/image-22.png 345w, https://couchlearn.com/wp-content/uploads/2019/10/image-22-150x150.png 150w, https://couchlearn.com/wp-content/uploads/2019/10/image-22-300x297.png 300w" sizes="(max-width: 345px) 100vw, 345px" /></figure>



<p>Rename this new file something suitable and save. In this example, I named mine PlayerInfo.</p>



<figure class="wp-block-image"><img decoding="async" width="74" height="112" src="https://couchlearn.com/wp-content/uploads/2019/10/image-24.png" alt="New struct" class="wp-image-862"/></figure>



<h3 class="wp-block-heading">Setting up the Struct</h3>



<p>Before we can start to use our new struct we need to fill it with variable types and give them the names that we want that data to be known as.</p>



<figure class="wp-block-image"><img decoding="async" width="924" height="261" src="https://couchlearn.com/wp-content/uploads/2019/10/image-25.png" alt="Struct variable menu" class="wp-image-863" srcset="https://couchlearn.com/wp-content/uploads/2019/10/image-25.png 924w, https://couchlearn.com/wp-content/uploads/2019/10/image-25-300x85.png 300w, https://couchlearn.com/wp-content/uploads/2019/10/image-25-768x217.png 768w" sizes="(max-width: 924px) 100vw, 924px" /></figure>



<p>In my case, I have added a Vector named &#8216;Player Location&#8217;, a Float named &#8216;Player Health&#8217;, an Integer named &#8216;Player Ammo&#8217; and another Integer named &#8216;Story Progression&#8217;.</p>



<figure class="wp-block-image"><img decoding="async" width="1024" height="330" src="https://couchlearn.com/wp-content/uploads/2019/10/image-26-1024x330.png" alt="New variables inside the struct" class="wp-image-864" srcset="https://couchlearn.com/wp-content/uploads/2019/10/image-26-1024x330.png 1024w, https://couchlearn.com/wp-content/uploads/2019/10/image-26-300x97.png 300w, https://couchlearn.com/wp-content/uploads/2019/10/image-26-768x248.png 768w, https://couchlearn.com/wp-content/uploads/2019/10/image-26.png 1038w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>This struct can now be added as a new variable in our main character blueprint.</p>



<h3 class="wp-block-heading">Creating the Struct on our Player Character</h3>



<p>To access the struct, simply create a new variable in our main character blueprint and set the type to the name of your struct created earlier.</p>



<figure class="wp-block-image"><img decoding="async" width="335" height="149" src="https://couchlearn.com/wp-content/uploads/2019/10/image-28.png" alt="Adding the struct to the player" class="wp-image-866" srcset="https://couchlearn.com/wp-content/uploads/2019/10/image-28.png 335w, https://couchlearn.com/wp-content/uploads/2019/10/image-28-300x133.png 300w" sizes="(max-width: 335px) 100vw, 335px" /></figure>



<p>Compile and save your blueprint to show the values of the struct. <br><br>I have set the initial values to 100 for the player&#8217;s health and 25 for the player&#8217;s ammo.</p>



<figure class="wp-block-image"><img decoding="async" width="476" height="436" src="https://couchlearn.com/wp-content/uploads/2019/10/image-37.png" alt="Adding values to the player struct" class="wp-image-876" srcset="https://couchlearn.com/wp-content/uploads/2019/10/image-37.png 476w, https://couchlearn.com/wp-content/uploads/2019/10/image-37-300x275.png 300w" sizes="(max-width: 476px) 100vw, 476px" /></figure>



<h3 class="wp-block-heading">Accessing the Struct on our Player Character</h3>



<h4 class="wp-block-heading">Getting the Values</h4>



<p>To get the values inside our struct, simply type get and then the struct variable name. In my case I typed &#8216;get PlayerValues&#8217;.</p>



<figure class="wp-block-image"><img decoding="async" width="410" height="118" src="https://couchlearn.com/wp-content/uploads/2019/10/image-31.png" alt="Get the struct" class="wp-image-870" srcset="https://couchlearn.com/wp-content/uploads/2019/10/image-31.png 410w, https://couchlearn.com/wp-content/uploads/2019/10/image-31-300x86.png 300w" sizes="(max-width: 410px) 100vw, 410px" /></figure>



<p>From this new get node, right click the pin and click the split struct pin button. This will now expose the values inside the struct.</p>



<figure class="wp-block-image"><img decoding="async" width="257" height="261" src="https://couchlearn.com/wp-content/uploads/2019/10/image-32.png" alt="Splitting the struct pin" class="wp-image-871"/></figure>



<p>From this get node, I access the PlayerAmmo value and can then print it to the screen using the Print String node. <br><br>This will now display my ammo on screen when the Left Mouse Button is pressed.</p>



<figure class="wp-block-image"><img decoding="async" width="485" height="311" src="https://couchlearn.com/wp-content/uploads/2019/10/image-33.png" alt="Printing the ammo value" class="wp-image-872" srcset="https://couchlearn.com/wp-content/uploads/2019/10/image-33.png 485w, https://couchlearn.com/wp-content/uploads/2019/10/image-33-300x192.png 300w" sizes="(max-width: 485px) 100vw, 485px" /></figure>



<h4 class="wp-block-heading">Setting the Values</h4>



<p>To set the values inside our struct, simply type set and then the name of your struct variable. In this case I typed &#8216;Set PlayerValues&#8217;.</p>



<figure class="wp-block-image"><img decoding="async" width="410" height="118" src="https://couchlearn.com/wp-content/uploads/2019/10/image-34.png" alt="Setting the player values struct" class="wp-image-873" srcset="https://couchlearn.com/wp-content/uploads/2019/10/image-34.png 410w, https://couchlearn.com/wp-content/uploads/2019/10/image-34-300x86.png 300w" sizes="(max-width: 410px) 100vw, 410px" /></figure>



<p>From there, right click the left pin of your Set PlayerValues node and click split struct pin. This will then expose the values of your struct variable which then can be set however you want.</p>



<figure class="wp-block-image"><img decoding="async" width="180" height="187" src="https://couchlearn.com/wp-content/uploads/2019/10/image-35.png" alt="Splitting the struct pin on the set node" class="wp-image-874"/></figure>



<p>For my character, I access the struct variable and set the Player Ammo value when I have fired my weapon using the Left Mouse Button.</p>



<figure class="wp-block-image"><img decoding="async" width="1024" height="322" src="https://couchlearn.com/wp-content/uploads/2019/10/image-36-1024x322.png" alt="Setting the ammo after every shot." class="wp-image-875" srcset="https://couchlearn.com/wp-content/uploads/2019/10/image-36-1024x322.png 1024w, https://couchlearn.com/wp-content/uploads/2019/10/image-36-300x94.png 300w, https://couchlearn.com/wp-content/uploads/2019/10/image-36-768x241.png 768w, https://couchlearn.com/wp-content/uploads/2019/10/image-36.png 1038w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption> This blueprint for firing is included in the default first person template character. </figcaption></figure>



<p class="has-text-align-center"><strong>When setting your values make sure to never leave any empty as they will be overwritten!</strong><br><br><strong>In the example above I set the location, health and story progression values to the values it already stored. </strong></p>



<h3 class="wp-block-heading">Example</h3>



<p>Every time the player presses the left mouse button the bullet is shot and one bullet is taken away from the ammo. The remaining ammo is then printed on the screen.</p>



<figure class="wp-block-image"><img decoding="async" width="916" height="538" src="https://couchlearn.com/wp-content/uploads/2019/10/image-38.png" alt="Shooting with left mouse button reduces the ammo and prints the ammo on the screen." class="wp-image-877" srcset="https://couchlearn.com/wp-content/uploads/2019/10/image-38.png 916w, https://couchlearn.com/wp-content/uploads/2019/10/image-38-300x176.png 300w, https://couchlearn.com/wp-content/uploads/2019/10/image-38-768x451.png 768w" sizes="(max-width: 916px) 100vw, 916px" /></figure>



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



<p>Now you have a fully working struct in your project that can now be used to store your player&#8217;s current status and progress. <br><br>This setup makes your general player variables much more organised and prevents data from being hard to track down.<br><br>The struct is a key part of shrinking large areas of blueprints into compact and efficient systems. <br><br>With this setup and working you can now create your own new structs for other gameplay tasks and uses.</p>



<h4 class="wp-block-heading">Further Examples</h4>



<p>Structs are great for creating a quest system. Each quest uses the struct for its location, enemies to spawn/ be defeated, gold reward and more. <br><br>This then can easily be added to a UMG widget to display the info on screen. Furthermore this can then be saved easily to preserve the player&#8217;s progress through the quests in your game.</p>



<p>One essential use for structs is to create an utilize Data Tables.</p>



<p><a href="https://docs.unrealengine.com/en-US/Engine/Blueprints/UserGuide/Variables/Structs/index.html">To read the Unreal Engine 4 documentation on Structs click here.</a></p>
<p>The post <a href="https://couchlearn.com/how-to-use-structs-in-unreal-engine-4/">How to use Structs in Unreal Engine 4</a> appeared first on <a href="https://couchlearn.com">Couch Learn</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://couchlearn.com/how-to-use-structs-in-unreal-engine-4/feed/</wfw:commentRss>
			<slash:comments>8</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-13 09:36:49 by W3 Total Cache
-->