<?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 Basics Archives - Couch Learn</title>
	<atom:link href="https://couchlearn.com/category/unreal-engine/unreal-basics/feed/" rel="self" type="application/rss+xml" />
	<link>https://couchlearn.com/category/unreal-engine/unreal-basics/</link>
	<description>Detailed Game Programming Tutorials</description>
	<lastBuildDate>Sat, 25 Jan 2025 17:34:27 +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 Basics Archives - Couch Learn</title>
	<link>https://couchlearn.com/category/unreal-engine/unreal-basics/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Getting started with Blueprint Functions in Unreal Engine 5</title>
		<link>https://couchlearn.com/getting-started-with-blueprint-functions-in-unreal-engine-5/</link>
					<comments>https://couchlearn.com/getting-started-with-blueprint-functions-in-unreal-engine-5/#respond</comments>
		
		<dc:creator><![CDATA[Matt]]></dc:creator>
		<pubDate>Sat, 25 Jan 2025 17:13:36 +0000</pubDate>
				<category><![CDATA[Easy Difficulty]]></category>
		<category><![CDATA[UE4 Basics]]></category>
		<category><![CDATA[Unreal Basics]]></category>
		<category><![CDATA[Unreal Engine]]></category>
		<category><![CDATA[easy]]></category>
		<category><![CDATA[easy difficulty]]></category>
		<category><![CDATA[ue4]]></category>
		<category><![CDATA[ue5]]></category>
		<category><![CDATA[ue5 basics]]></category>
		<category><![CDATA[unreal basics]]></category>
		<category><![CDATA[unreal engine]]></category>
		<category><![CDATA[unreal engine 4]]></category>
		<category><![CDATA[unreal engine 5]]></category>
		<guid isPermaLink="false">https://couchlearn.com/?p=1793</guid>

					<description><![CDATA[<p>One fundamental is the concept in programming is the function. Functions are self contained code that can be run from anywhere. Unreal Engine 5 blueprints <a class="mh-excerpt-more" href="https://couchlearn.com/getting-started-with-blueprint-functions-in-unreal-engine-5/" title="Getting started with Blueprint Functions in Unreal Engine 5">[...]</a></p>
<p>The post <a href="https://couchlearn.com/getting-started-with-blueprint-functions-in-unreal-engine-5/">Getting started with Blueprint Functions in Unreal Engine 5</a> appeared first on <a href="https://couchlearn.com">Couch Learn</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>One fundamental is the concept in programming is the function. Functions are self contained code that can be run from anywhere.<br><br>Unreal Engine 5 blueprints also have functions that you can use to separate your nodes inside the blueprint editor.<br><br>In this guide we will be showing you how to get started with Blueprint Functions in Unreal Engine 5!</p>



<h2 class="wp-block-heading">What is a Function?</h2>



<p>Blueprint Functions are self-contained pieces of logic that you can create once and run from multiple places in your Blueprints. They allow input and output parameters for flexibility.</p>



<p>For example, instead of writing the same logic to calculate damage multiple times, you can create a function called <strong><em>CalculateDamage</em></strong>, call it wherever needed, and update it in one place if changes are required.<br><br>Note that a function is created for a specific blueprint actor and can only be used<br><br>In this guide we are going to start right from the beginning and create a simple function to help you understand this concept. We then expand upon this and show you more features that functions can have!</p>



<h2 class="wp-block-heading">Creating a Function</h2>



<p>To start, we are going to make a simple function that prints a string to the screen.<br><br>Firstly we need to open the blueprint actor that we want to add the function to. In this example we are using the FirstPersonCharacter blueprint from the First Person Shooter template provided by Unreal Engine.<br><br>As you can see in the image below, on the left side of the editor window, there is a drop down section named &#8220;Functions&#8221;. This section is where all of our functions live for this specific blueprint.<br><br>We can create a new function by clicking the circle with a plus symbol on the right side of the functions drop down as shown in the image below.</p>



<figure class="wp-block-image size-large is-resized"><img fetchpriority="high" decoding="async" width="854" height="1024" src="https://couchlearn.com/wp-content/uploads/2022/11/image-9-854x1024.png" alt="Creating a function using the Unreal blueprint editor" class="wp-image-1825" style="width:738px;height:auto" srcset="https://couchlearn.com/wp-content/uploads/2022/11/image-9-854x1024.png 854w, https://couchlearn.com/wp-content/uploads/2022/11/image-9-250x300.png 250w, https://couchlearn.com/wp-content/uploads/2022/11/image-9-768x921.png 768w, https://couchlearn.com/wp-content/uploads/2022/11/image-9.png 866w" sizes="(max-width: 854px) 100vw, 854px" /></figure>



<p>Next, we can then give our function a name. It is advised to give our functions readable and clear names to keep our project clean. </p>



<p>Messy names that are confusing make developing a large project difficult so it is best to keep this in mind.<br><br>Once the function is named either press enter, or click anywhere in the blueprint window, then click the &#8220;Compile&#8221; button as indicated in the image. This then creates our function and compiles it into the blueprint so we can start using it in our project. </p>



<figure class="wp-block-image size-full"><img decoding="async" width="544" height="716" src="https://couchlearn.com/wp-content/uploads/2022/11/image-10.png" alt="Naming the function then clicking the compile issue" class="wp-image-1826" srcset="https://couchlearn.com/wp-content/uploads/2022/11/image-10.png 544w, https://couchlearn.com/wp-content/uploads/2022/11/image-10-228x300.png 228w" sizes="(max-width: 544px) 100vw, 544px" /></figure>



<h3 class="wp-block-heading">Adding Basic Functionality</h3>



<p>Now that we have our new function created and compiled, we can see it doesn&#8217;t do anything at the moment. We need to add some simple functionality!<br><br>In this first example we are printing a string to the screen. To achieve this we need to add that node to our function.<br><br>First, click and drag from the white sidewards triangle on our &#8220;My Custom Function&#8221; node. This is called an <strong>exec pin</strong> and allows us to add pieces of code together to run one after another (sequentially).<br><br>Once we click and drag then let go of the click, anywhere on the grey background grid, we then are greeted with a popup menu showing all of the blueprint nodes (these are functions!) we can add to our own function.<br><br>Click &#8220;Print String&#8221; in the menu, this creates the &#8220;Print String&#8221; node in our function graph. </p>



<figure class="wp-block-image size-full"><img decoding="async" width="585" height="329" src="https://couchlearn.com/wp-content/uploads/2022/11/image-11.png" alt="Adding the print string node to the new custom function" class="wp-image-1827" srcset="https://couchlearn.com/wp-content/uploads/2022/11/image-11.png 585w, https://couchlearn.com/wp-content/uploads/2022/11/image-11-300x169.png 300w" sizes="(max-width: 585px) 100vw, 585px" /></figure>



<p>As we dragged from the white exec pin, our Print String node is automatically connected to our MyCustomFunction as shown in the image below.</p>



<figure class="wp-block-image size-full is-resized"><img decoding="async" width="926" height="422" src="https://couchlearn.com/wp-content/uploads/2025/01/image-1.png" alt="The created print string node attached to our MyCustomFunction" class="wp-image-2132" style="width:465px;height:auto" srcset="https://couchlearn.com/wp-content/uploads/2025/01/image-1.png 926w, https://couchlearn.com/wp-content/uploads/2025/01/image-1-300x137.png 300w, https://couchlearn.com/wp-content/uploads/2025/01/image-1-768x350.png 768w" sizes="(max-width: 926px) 100vw, 926px" /></figure>



<p>When our &#8220;My Custom Function&#8221; runs, it will now run the Print String node that is connected to it!<br><br>You may also see people talking about &#8220;call&#8221;, &#8220;called&#8221;, or &#8220;calling&#8221; functions. This is the same as running a function!</p>



<h3 class="wp-block-heading">Testing our Print String</h3>



<p>Now that our function is setup to print a string to the output log we need to run our function. The easiest way is to run our function on Begin Play!<br><br>Begin play is an &#8220;Event&#8221;. An event is similar to a function but cannot return values and can run a few special asynchronous nodes that functions cannot.<br><br>Begin Play is an event that is called when the actor is spawned into the game world. As our FirstPersonCharacter already is in the game world, this Begin Play event runs code when the game starts.<br><br>We first want to click the Event Graph button at the top of the blueprint editor.</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" width="1024" height="617" src="https://couchlearn.com/wp-content/uploads/2025/01/image-3-1024x617.png" alt="Clicking back onto the Event Graph" class="wp-image-2134" style="width:610px;height:auto" srcset="https://couchlearn.com/wp-content/uploads/2025/01/image-3-1024x617.png 1024w, https://couchlearn.com/wp-content/uploads/2025/01/image-3-300x181.png 300w, https://couchlearn.com/wp-content/uploads/2025/01/image-3-768x463.png 768w, https://couchlearn.com/wp-content/uploads/2025/01/image-3-1536x926.png 1536w, https://couchlearn.com/wp-content/uploads/2025/01/image-3.png 1768w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>Now our main blueprint event graph will appear again on the screen.</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" width="1024" height="649" src="https://couchlearn.com/wp-content/uploads/2025/01/image-5-1024x649.png" alt="Back in the event graph in the blueprint editor" class="wp-image-2136" style="width:625px;height:auto" srcset="https://couchlearn.com/wp-content/uploads/2025/01/image-5-1024x649.png 1024w, https://couchlearn.com/wp-content/uploads/2025/01/image-5-300x190.png 300w, https://couchlearn.com/wp-content/uploads/2025/01/image-5-768x486.png 768w, https://couchlearn.com/wp-content/uploads/2025/01/image-5-1536x973.png 1536w, https://couchlearn.com/wp-content/uploads/2025/01/image-5-2048x1297.png 2048w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>Find somewhere free and right click. In the box that appears search for Event Begin Play and click it to create the event.</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" width="1024" height="567" src="https://couchlearn.com/wp-content/uploads/2025/01/image-7-1024x567.png" alt="Creating a new BeginPlay event in the event graph" class="wp-image-2138" style="width:598px;height:auto" srcset="https://couchlearn.com/wp-content/uploads/2025/01/image-7-1024x567.png 1024w, https://couchlearn.com/wp-content/uploads/2025/01/image-7-300x166.png 300w, https://couchlearn.com/wp-content/uploads/2025/01/image-7-768x425.png 768w, https://couchlearn.com/wp-content/uploads/2025/01/image-7-1536x851.png 1536w, https://couchlearn.com/wp-content/uploads/2025/01/image-7.png 1910w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>Unreal Engine will automatically run the Begin Play event as described in the previous section so no setup is required. <br><br>Like before, drag from the white exec pin and let go of the mouse click in the grid. In the pop up menu, search for our MyCustomFunction and click it in the list.</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" width="1024" height="492" src="https://couchlearn.com/wp-content/uploads/2025/01/image-9-1024x492.png" alt="Creating our MyCustomFunction as a node connected to the BeginPlay event" class="wp-image-2141" style="width:606px;height:auto" srcset="https://couchlearn.com/wp-content/uploads/2025/01/image-9-1024x492.png 1024w, https://couchlearn.com/wp-content/uploads/2025/01/image-9-300x144.png 300w, https://couchlearn.com/wp-content/uploads/2025/01/image-9-768x369.png 768w, https://couchlearn.com/wp-content/uploads/2025/01/image-9-1536x738.png 1536w, https://couchlearn.com/wp-content/uploads/2025/01/image-9.png 1950w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>Now our MyCustomFunction is connected to our BeginPlay event. The last step is to press the Compile button and save our blueprint.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="576" src="https://couchlearn.com/wp-content/uploads/2025/01/image-14-1024x576.png" alt="Making sure to compile and save our changes" class="wp-image-2146" srcset="https://couchlearn.com/wp-content/uploads/2025/01/image-14-1024x576.png 1024w, https://couchlearn.com/wp-content/uploads/2025/01/image-14-300x169.png 300w, https://couchlearn.com/wp-content/uploads/2025/01/image-14-768x432.png 768w, https://couchlearn.com/wp-content/uploads/2025/01/image-14-1536x864.png 1536w, https://couchlearn.com/wp-content/uploads/2025/01/image-14-678x381.png 678w, https://couchlearn.com/wp-content/uploads/2025/01/image-14.png 1728w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>Clicking play now in our FirstPersonMap will print &#8220;hello&#8221; in our output log.</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" width="1024" height="241" src="https://couchlearn.com/wp-content/uploads/2025/01/image-16-1024x241.png" alt="Demonstrating MyCustomFunction printing Hello to the output log." class="wp-image-2149" style="width:739px;height:auto" srcset="https://couchlearn.com/wp-content/uploads/2025/01/image-16-1024x241.png 1024w, https://couchlearn.com/wp-content/uploads/2025/01/image-16-300x71.png 300w, https://couchlearn.com/wp-content/uploads/2025/01/image-16-768x181.png 768w, https://couchlearn.com/wp-content/uploads/2025/01/image-16-1536x362.png 1536w, https://couchlearn.com/wp-content/uploads/2025/01/image-16.png 2014w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<h3 class="wp-block-heading">Adding more functionality</h3>



<p>Now we have text printing on the screen! That&#8217;s great for testing but not very useful for gameplay. Lets add some more functionality to our blueprint function.<br><br>In this next example we are going to make the <strong>CalculateDamage</strong> function we talked about earlier!<br><br>This function will take in a number called &#8220;<strong>damage</strong>&#8220;, seeing how much &#8220;<strong>armor</strong>&#8221; our character has, then finally subtract the amount of &#8220;<strong>armor</strong>&#8221; from our &#8220;<strong>damage</strong>&#8221; number. In short we are calculating how much damage is dealt after our &#8220;<strong>armor</strong>&#8221; has absorbed some of the damage.</p>



<h4 class="wp-block-heading">Notes on advanced functionality</h4>



<p class="has-text-align-left">Delay nodes are not supported in functions. If your blueprint needs delay nodes, consider using Custom Events. <a href="https://couchlearn.com/how-to-use-custom-events-in-unreal-engine-4">Click here to read our guide on How to use Custom Events in Unreal Engine</a>.</p>



<h4 class="wp-block-heading">Making the CalculateDamage function</h4>



<p>To achieve this goal of our CalculateDamage function, first we need to input data into our function.<br><br>Firstly, click the purple &#8220;My Custom Event&#8221; node. You should now see in the details window on the right side of the editor sections for Input and Output.</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" width="1024" height="599" src="https://couchlearn.com/wp-content/uploads/2025/01/image-17-1024x599.png" alt="Showing the input and output sections of the function editor" class="wp-image-2157" style="width:759px;height:auto" srcset="https://couchlearn.com/wp-content/uploads/2025/01/image-17-1024x599.png 1024w, https://couchlearn.com/wp-content/uploads/2025/01/image-17-300x175.png 300w, https://couchlearn.com/wp-content/uploads/2025/01/image-17-768x449.png 768w, https://couchlearn.com/wp-content/uploads/2025/01/image-17-1536x898.png 1536w, https://couchlearn.com/wp-content/uploads/2025/01/image-17.png 1960w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>As we are focussing on Input, click the small add button to add a new Input Variable.</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" width="1024" height="422" src="https://couchlearn.com/wp-content/uploads/2025/01/image-18-1024x422.png" alt="Adding a new input parameter to our function" class="wp-image-2158" style="width:760px;height:auto" srcset="https://couchlearn.com/wp-content/uploads/2025/01/image-18-1024x422.png 1024w, https://couchlearn.com/wp-content/uploads/2025/01/image-18-300x124.png 300w, https://couchlearn.com/wp-content/uploads/2025/01/image-18-768x316.png 768w, https://couchlearn.com/wp-content/uploads/2025/01/image-18-1536x633.png 1536w, https://couchlearn.com/wp-content/uploads/2025/01/image-18.png 1736w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>We now see a new input parameter for our function.</p>



<figure class="wp-block-image size-full is-resized"><img decoding="async" width="720" height="120" src="https://couchlearn.com/wp-content/uploads/2025/01/image-19.png" alt="The newly created parameter" class="wp-image-2160" style="width:540px;height:auto" srcset="https://couchlearn.com/wp-content/uploads/2025/01/image-19.png 720w, https://couchlearn.com/wp-content/uploads/2025/01/image-19-300x50.png 300w" sizes="(max-width: 720px) 100vw, 720px" /></figure>



<p>In this example we want to pass in a number so we change the &#8220;Boolean&#8221; to &#8220;Float&#8221;.</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" width="1024" height="677" src="https://couchlearn.com/wp-content/uploads/2025/01/image-20-1024x677.png" alt="Changing the parameter's type to Float" class="wp-image-2161" style="width:693px;height:auto" srcset="https://couchlearn.com/wp-content/uploads/2025/01/image-20-1024x677.png 1024w, https://couchlearn.com/wp-content/uploads/2025/01/image-20-300x198.png 300w, https://couchlearn.com/wp-content/uploads/2025/01/image-20-768x508.png 768w, https://couchlearn.com/wp-content/uploads/2025/01/image-20-1536x1015.png 1536w, https://couchlearn.com/wp-content/uploads/2025/01/image-20.png 1808w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>Next in the left text box give our new property a name. We are naming this &#8220;Damage&#8221;.<br><br>So far the function should look like this.</p>



<figure class="wp-block-image size-full is-resized"><img decoding="async" width="900" height="358" src="https://couchlearn.com/wp-content/uploads/2025/01/image-21.png" alt="The function now has the Damage input parameter" class="wp-image-2163" style="width:518px;height:auto" srcset="https://couchlearn.com/wp-content/uploads/2025/01/image-21.png 900w, https://couchlearn.com/wp-content/uploads/2025/01/image-21-300x119.png 300w, https://couchlearn.com/wp-content/uploads/2025/01/image-21-768x305.png 768w" sizes="(max-width: 900px) 100vw, 900px" /></figure>



<p>Now we are adding some other nodes to calculate our damage value.<br><br>To do this first, drag from the green Damage pin into the grid and let go of the mouse click. In the popup search &#8220;-&#8221; or &#8220;subtract&#8221; to find the subtract node.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="509" src="https://couchlearn.com/wp-content/uploads/2025/01/image-23-1024x509.png" alt="Adding a subtract float node and connecting it to our Damage parameter" class="wp-image-2166" srcset="https://couchlearn.com/wp-content/uploads/2025/01/image-23-1024x509.png 1024w, https://couchlearn.com/wp-content/uploads/2025/01/image-23-300x149.png 300w, https://couchlearn.com/wp-content/uploads/2025/01/image-23-768x381.png 768w, https://couchlearn.com/wp-content/uploads/2025/01/image-23.png 1510w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>Next we click and drag from the bottom subtract node pin and let go, in the menu we then click &#8220;Promote to variable&#8221;. This will create a new variable that we name &#8220;Armor&#8221; to store our character&#8217;s armour number.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="640" src="https://couchlearn.com/wp-content/uploads/2025/01/image-24-1024x640.png" alt="Promoting a new Armor variable connected to the subtraction node" class="wp-image-2167" srcset="https://couchlearn.com/wp-content/uploads/2025/01/image-24-1024x640.png 1024w, https://couchlearn.com/wp-content/uploads/2025/01/image-24-300x188.png 300w, https://couchlearn.com/wp-content/uploads/2025/01/image-24-768x480.png 768w, https://couchlearn.com/wp-content/uploads/2025/01/image-24.png 1472w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>Next, click the new armor variable in the graph and on the right side details panel and set the armor value to any number you want. In this example we set armor to 15.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="502" src="https://couchlearn.com/wp-content/uploads/2025/01/image-26-1024x502.png" alt="Setting the value of the Armor variable to 15.0" class="wp-image-2169" srcset="https://couchlearn.com/wp-content/uploads/2025/01/image-26-1024x502.png 1024w, https://couchlearn.com/wp-content/uploads/2025/01/image-26-300x147.png 300w, https://couchlearn.com/wp-content/uploads/2025/01/image-26-768x377.png 768w, https://couchlearn.com/wp-content/uploads/2025/01/image-26-1536x753.png 1536w, https://couchlearn.com/wp-content/uploads/2025/01/image-26.png 1750w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>Our MyCustomFunction now takes in the Damage value and subtracts Armor from itself, this is then printed into the output log.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="379" src="https://couchlearn.com/wp-content/uploads/2025/01/image-25-1024x379.png" alt="Our finished input parameter" class="wp-image-2168" srcset="https://couchlearn.com/wp-content/uploads/2025/01/image-25-1024x379.png 1024w, https://couchlearn.com/wp-content/uploads/2025/01/image-25-300x111.png 300w, https://couchlearn.com/wp-content/uploads/2025/01/image-25-768x285.png 768w, https://couchlearn.com/wp-content/uploads/2025/01/image-25.png 1112w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<h3 class="wp-block-heading">Returning our value</h3>



<p>Our function now calculates values but does not send those values anywhere! We need to &#8220;<strong>return&#8221;</strong> this value out of our new function.<br><br>Returning a value is the word used to describe the output of our function. In Unreal Engine Blueprints we can have as many input and output values as we like.<br><br>First click our MyCustomFunction and look to the details panel on the right side of the editor again.<br><br>This time we are clicking the plus button on the Output section.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="355" src="https://couchlearn.com/wp-content/uploads/2025/01/image-28-1024x355.png" alt="Adding a new output parameter to the function" class="wp-image-2174" srcset="https://couchlearn.com/wp-content/uploads/2025/01/image-28-1024x355.png 1024w, https://couchlearn.com/wp-content/uploads/2025/01/image-28-300x104.png 300w, https://couchlearn.com/wp-content/uploads/2025/01/image-28-768x267.png 768w, https://couchlearn.com/wp-content/uploads/2025/01/image-28-1536x533.png 1536w, https://couchlearn.com/wp-content/uploads/2025/01/image-28.png 1896w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>In the newly created Output result, change the type to Float and set the name to Result. </p>



<figure class="wp-block-image size-full"><img decoding="async" width="734" height="124" src="https://couchlearn.com/wp-content/uploads/2025/01/image-29.png" alt="Setting the name of the output parameter to Result and setting the type to float" class="wp-image-2175" srcset="https://couchlearn.com/wp-content/uploads/2025/01/image-29.png 734w, https://couchlearn.com/wp-content/uploads/2025/01/image-29-300x51.png 300w" sizes="(max-width: 734px) 100vw, 734px" /></figure>



<p>After creating the new output parameter a &#8220;Return Node&#8221; will be created automatically in the graph.<br><br>This Return Node result pin is where we can &#8220;return&#8221; our values out of the function.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="363" src="https://couchlearn.com/wp-content/uploads/2025/01/image-30-1024x363.png" alt="The engine creates a return node when an output parameter is created" class="wp-image-2176" srcset="https://couchlearn.com/wp-content/uploads/2025/01/image-30-1024x363.png 1024w, https://couchlearn.com/wp-content/uploads/2025/01/image-30-300x106.png 300w, https://couchlearn.com/wp-content/uploads/2025/01/image-30-768x272.png 768w, https://couchlearn.com/wp-content/uploads/2025/01/image-30-1536x545.png 1536w, https://couchlearn.com/wp-content/uploads/2025/01/image-30.png 1866w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>We then delete the print string from the function as we no longer need it inside the function.<br><br>Our final function now looks like this.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="300" src="https://couchlearn.com/wp-content/uploads/2025/01/image-31-1024x300.png" alt="The finished function doing a basic subtraction" class="wp-image-2178" srcset="https://couchlearn.com/wp-content/uploads/2025/01/image-31-1024x300.png 1024w, https://couchlearn.com/wp-content/uploads/2025/01/image-31-300x88.png 300w, https://couchlearn.com/wp-content/uploads/2025/01/image-31-768x225.png 768w, https://couchlearn.com/wp-content/uploads/2025/01/image-31.png 1106w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>In the event graph our function now looks like this. We can give it a &#8220;damage&#8221; value and get a &#8220;result&#8221; value out from the function!</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="423" src="https://couchlearn.com/wp-content/uploads/2025/01/image-32-1024x423.png" alt="The final function with and input and return value in the event graph" class="wp-image-2179" srcset="https://couchlearn.com/wp-content/uploads/2025/01/image-32-1024x423.png 1024w, https://couchlearn.com/wp-content/uploads/2025/01/image-32-300x124.png 300w, https://couchlearn.com/wp-content/uploads/2025/01/image-32-768x318.png 768w, https://couchlearn.com/wp-content/uploads/2025/01/image-32.png 1040w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>To test this is working we set damage to 20.0 and connect our returned result value to a print string node.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="354" src="https://couchlearn.com/wp-content/uploads/2025/01/image-33-1024x354.png" alt="Setting the damage value to 20.0" class="wp-image-2181" srcset="https://couchlearn.com/wp-content/uploads/2025/01/image-33-1024x354.png 1024w, https://couchlearn.com/wp-content/uploads/2025/01/image-33-300x104.png 300w, https://couchlearn.com/wp-content/uploads/2025/01/image-33-768x266.png 768w, https://couchlearn.com/wp-content/uploads/2025/01/image-33.png 1358w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



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



<p>Finally, with our damage set to 20 and our armor set to 15, when we call our MyCustomFunction we get the value 5!<br><br><strong><em>20 &#8211; 15 = 5</em></strong><br><br>In the output you can see that our returned value of 5 is printed to the log!</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="187" src="https://couchlearn.com/wp-content/uploads/2025/01/image-35-1024x187.png" alt="Our final function calculating 20 - 15 and returning 5" class="wp-image-2189" srcset="https://couchlearn.com/wp-content/uploads/2025/01/image-35-1024x187.png 1024w, https://couchlearn.com/wp-content/uploads/2025/01/image-35-300x55.png 300w, https://couchlearn.com/wp-content/uploads/2025/01/image-35-768x140.png 768w, https://couchlearn.com/wp-content/uploads/2025/01/image-35-1536x280.png 1536w, https://couchlearn.com/wp-content/uploads/2025/01/image-35.png 2006w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



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



<p>You’ve now taken the first steps in getting started with Blueprint Functions in Unreal Engine 5! These essential aspects of programming allow you to separate logic into reusable nodes, cleaning up your blueprint actors and making your dream game easier to manage.</p>



<p>The basic concept and example covered in this guide provides a foundation to build upon. Whether you&#8217;re building gameplay mechanics, working on core technology, or cleaning up your existing code, Blueprint Functions are a fundamental aspect of Unreal Engine development.</p>



<p><strong>Further Reading:</strong></p>



<ul class="wp-block-list">
<li><a href="https://docs.unrealengine.com/4.26/en-US/ProgrammingAndScripting/Blueprints/UserGuide/Functions/" target="_blank" rel="noreferrer noopener">Click here to read the official blueprint function unreal engine documentation</a></li>



<li><a href="https://www.youtube.com/watch?v=GDnU_6tTPKc" target="_blank" rel="noreferrer noopener">Click here to watch Mathew Wadstein&#8217;s in depth blueprint function guide on YouTube</a> (Not affiliated or associated with CouchLearn)</li>
</ul>
<p>The post <a href="https://couchlearn.com/getting-started-with-blueprint-functions-in-unreal-engine-5/">Getting started with Blueprint Functions in Unreal Engine 5</a> appeared first on <a href="https://couchlearn.com">Couch Learn</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://couchlearn.com/getting-started-with-blueprint-functions-in-unreal-engine-5/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to use Timers in Unreal Engine 5</title>
		<link>https://couchlearn.com/how-to-use-timers-in-unreal-engine-5/</link>
					<comments>https://couchlearn.com/how-to-use-timers-in-unreal-engine-5/#respond</comments>
		
		<dc:creator><![CDATA[Matt]]></dc:creator>
		<pubDate>Wed, 16 Nov 2022 22:00:18 +0000</pubDate>
				<category><![CDATA[UE4 Basics]]></category>
		<category><![CDATA[Unreal Basics]]></category>
		<category><![CDATA[Unreal Engine]]></category>
		<category><![CDATA[Unreal Engine 4]]></category>
		<category><![CDATA[Unreal Engine 5]]></category>
		<category><![CDATA[easy]]></category>
		<category><![CDATA[easy difficulty]]></category>
		<category><![CDATA[ue4]]></category>
		<category><![CDATA[ue4 basics]]></category>
		<category><![CDATA[ue4 timer]]></category>
		<category><![CDATA[ue5 timer]]></category>
		<category><![CDATA[unreal engine]]></category>
		<category><![CDATA[unreal engine 4]]></category>
		<category><![CDATA[unreal engine 4 timer]]></category>
		<category><![CDATA[unreal engine 5]]></category>
		<category><![CDATA[unreal engine 5 timer]]></category>
		<guid isPermaLink="false">https://couchlearn.com/?p=1383</guid>

					<description><![CDATA[<p>Timers are one of the best ways to run blueprint code periodically without using Event Tick. Unreal Engine will trigger your event or function automatically <a class="mh-excerpt-more" href="https://couchlearn.com/how-to-use-timers-in-unreal-engine-5/" title="How to use Timers in Unreal Engine 5">[...]</a></p>
<p>The post <a href="https://couchlearn.com/how-to-use-timers-in-unreal-engine-5/">How to use Timers in Unreal Engine 5</a> appeared first on <a href="https://couchlearn.com">Couch Learn</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Timers are one of the best ways to run blueprint code periodically without using Event Tick. Unreal Engine will trigger your event or function automatically at the time set instead of constantly polling your functionality every frame.<br><br><strong>Using timers can prevent actors reducing your game&#8217;s frame rate if implemented correctly.</strong><br><br>In this guide we will be learning how to use Timers in Unreal Engine 5.</p>



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



<p>To understand this guide and implement timers into your project, you will need to know how to use custom events and functions in Unreal Engine 5 before starting.</p>



<p><a href="https://couchlearn.com/how-to-use-custom-events-in-unreal-engine-4/">Click here to read our guide on custom events.</a></p>



<h2 class="wp-block-heading">How to create Blueprint Timers</h2>



<h3 class="wp-block-heading">Basic Timer Settings</h3>



<p>Before we create our timer, we will look at the basic timer settings that all timers have. These allow us to set the frequency of the timer and if the timer repeats or not.<br><br>The green <strong>Time </strong>pin is the time Unreal Engine will wait to call your event. <strong>If this value is less than or equal to 0, the timer will be cleared and will not call the event.</strong></p>



<figure class="wp-block-image size-large"><img decoding="async" width="245" height="180" src="https://couchlearn.com/wp-content/uploads/2021/01/image-13.png" alt="Setting the timer Time value. This sets the frequency of your timer." class="wp-image-1390"/></figure>



<p>The <strong>Looping</strong> check box will repeat the timer if set to <strong>true </strong>and only run once if set to <strong>false</strong>. Ticking this box is best for functionality that you want to run repeatedly.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="243" height="178" src="https://couchlearn.com/wp-content/uploads/2021/01/image-14.png" alt="Setting the Looping value of the timer. This will loop at the frequency set if true." class="wp-image-1391"/></figure>



<h3 class="wp-block-heading">Timer by Event</h3>



<p>When you want to create a timer that uses a custom event in the event graph, you need to use Set Timer by Event.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="241" height="176" src="https://couchlearn.com/wp-content/uploads/2021/01/image-10.png" alt="Creating a new timer by event" class="wp-image-1385"/></figure>



<p>As shown below, your custom events can be connected using the red event delegate square. Any custom event are connected to this pin to trigger on the time set. Only one event is connected at a time.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="516" height="268" src="https://couchlearn.com/wp-content/uploads/2021/01/image-12.png" alt="Connecting the timer to the event" class="wp-image-1389" srcset="https://couchlearn.com/wp-content/uploads/2021/01/image-12.png 516w, https://couchlearn.com/wp-content/uploads/2021/01/image-12-300x156.png 300w" sizes="(max-width: 516px) 100vw, 516px" /></figure>



<h3 class="wp-block-heading">Timer by Function</h3>



<p>If you want to use a function instead of an event delegate, we have the Timer by Function Name blueprint node. This has function name and object pins replacing the red delegate pin.<br><br>Object is the reference to the object that you want to run the function on (e.g. FirstPersonCharacter or your own custom actors). <strong>If you want to run the function on this actor, you can leave this pin empty.</strong><br><br>&#8220;Function Name&#8221; is the name of the function found in the function list in your object.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="285" height="219" src="https://couchlearn.com/wp-content/uploads/2021/01/image-11.png" alt="Creating a timer with a function" class="wp-image-1387"/></figure>



<p>In this example we have created a new function in the My Blueprint panel on the left of the blueprint editor. Our new function is called <strong>MyCustomFunction</strong>.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="289" height="216" src="https://couchlearn.com/wp-content/uploads/2021/01/image-17.png" alt="Creating a new function in the blueprint editor" class="wp-image-1395"/></figure>



<p>Now our function has been created, we then add the functions name into the Function Name pin.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="301" height="236" src="https://couchlearn.com/wp-content/uploads/2021/01/image-16.png" alt="Setting a new timer's function name to the function we created in the previous step." class="wp-image-1394"/></figure>



<p><strong>The blueprint node above now run MyCustomFunction after 5 seconds without looping.</strong></p>



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



<p>If you want to change any properties about a timer, you need to save a reference to the return value. The easiest way to do this is to drag from the return value and click Promote to Variable.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="787" height="295" src="https://couchlearn.com/wp-content/uploads/2021/01/image-20.png" alt="Promoting the return value of the new timer to a variable for use later." class="wp-image-1400" srcset="https://couchlearn.com/wp-content/uploads/2021/01/image-20.png 787w, https://couchlearn.com/wp-content/uploads/2021/01/image-20-300x112.png 300w, https://couchlearn.com/wp-content/uploads/2021/01/image-20-768x288.png 768w" sizes="(max-width: 787px) 100vw, 787px" /></figure>



<h3 class="wp-block-heading">Pausing and Unpausing Timers</h3>



<p>Now we have a reference to our timer, we can pause and un-pause the timer. The nodes below show the handle and function versions of pausing and unpausing your timer.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="199" height="91" src="https://couchlearn.com/wp-content/uploads/2021/01/image-18.png" alt="Pausing the timer by handle" class="wp-image-1397"/></figure>



<figure class="wp-block-image size-large"><img decoding="async" width="212" height="94" src="https://couchlearn.com/wp-content/uploads/2021/01/image-21.png" alt="Unpausing the timer by handle" class="wp-image-1402"/></figure>



<p>Function timers can be paused and unpaused using the function name and do not need a timer handle.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="247" height="152" src="https://couchlearn.com/wp-content/uploads/2021/01/image-19.png" alt="Pausing the timer by function name" class="wp-image-1398"/></figure>



<figure class="wp-block-image size-large"><img decoding="async" width="262" height="155" src="https://couchlearn.com/wp-content/uploads/2021/01/image-23.png" alt="Un pausing the timer by function name" class="wp-image-1405"/></figure>



<h3 class="wp-block-heading">Removing a Timer</h3>



<p>When you need a timer to stop, use the clear and invalidate timer blueprint nodes. These nodes will stop the timer and destroy the specified handle object.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="278" height="92" src="https://couchlearn.com/wp-content/uploads/2021/01/image-24.png" alt="Clearing and invalidating the timer by handle" class="wp-image-1407"/></figure>



<p>When using a Function Timer, you will need to clear and invalidate the timer separately if you want to use a function name.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="457" height="161" src="https://couchlearn.com/wp-content/uploads/2021/01/image-30.png" alt="Clearing the timer by function name then invalidating the handle separately" class="wp-image-1417" srcset="https://couchlearn.com/wp-content/uploads/2021/01/image-30.png 457w, https://couchlearn.com/wp-content/uploads/2021/01/image-30-300x106.png 300w" sizes="(max-width: 457px) 100vw, 457px" /></figure>



<h3 class="wp-block-heading">Checking a Timer&#8217;s Status</h3>



<p>With the handle or function name, you can check various properties about a timer.<br><br>Firstly we have Does Timer Exist. These nodes check if the timer exists in memory. <strong>If the timer is cleared and invalidated this value is false.</strong></p>



<figure class="wp-block-image size-large"><img decoding="async" width="286" height="209" src="https://couchlearn.com/wp-content/uploads/2021/01/image-31.png" alt="Checking if the timer exists by handle or by function name" class="wp-image-1418"/></figure>



<p>Is Timer Active will return true if the handle or function name has a timer that is actively running and exists.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="292" height="210" src="https://couchlearn.com/wp-content/uploads/2021/01/image-28.png" alt="Checking if the timer is active by function name or handle" class="wp-image-1414"/></figure>



<p>&#8220;Is Timer Paused&#8221; returns true if the timer is not actively running but does exist.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="292" height="215" src="https://couchlearn.com/wp-content/uploads/2021/01/image-32.png" alt="Checking if the timer is paused by function name or handle" class="wp-image-1419"/></figure>



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



<p>Now you have all the knowledge to use timers in your blueprint code in Unreal Engine 5!<br><br>Having all of these nodes at your disposal allows code and functionality to run at specific times and at certain frequencies. This will overall improve the readability of your code and can bring great performance gains. We recommend setting the Time value to 0.1 or 0.05 seconds instead of running every frame on tick.<br><br>Further reading:<br><a href="https://docs.unrealengine.com/4.26/en-US/InteractiveExperiences/UseTimers/">In depth use of timers with gameplay example from Unreal Engine documentation<br></a><a href="https://docs.unrealengine.com/en-US/ProgrammingAndScripting/ProgrammingWithCPP/UnrealArchitecture/Timers/index.html">Click here to read how C++ Timers work in Unreal Engine</a></p>
<p>The post <a href="https://couchlearn.com/how-to-use-timers-in-unreal-engine-5/">How to use Timers 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-use-timers-in-unreal-engine-5/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to use Custom Events in Unreal Engine 4</title>
		<link>https://couchlearn.com/how-to-use-custom-events-in-unreal-engine-4/</link>
					<comments>https://couchlearn.com/how-to-use-custom-events-in-unreal-engine-4/#respond</comments>
		
		<dc:creator><![CDATA[Matt]]></dc:creator>
		<pubDate>Sun, 10 Jan 2021 23:34:09 +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 custom event]]></category>
		<category><![CDATA[unreal custom event]]></category>
		<category><![CDATA[unreal engine]]></category>
		<category><![CDATA[unreal engine 4]]></category>
		<category><![CDATA[unreal engine 4 basics]]></category>
		<category><![CDATA[unreal engine 4 custom event]]></category>
		<category><![CDATA[unreal engine basics]]></category>
		<guid isPermaLink="false">https://couchlearn.com/?p=1421</guid>

					<description><![CDATA[<p>An essential part of developing games with Unreal Engine 4 is learning Custom Events. Custom events are used to run a set of blueprint nodes <a class="mh-excerpt-more" href="https://couchlearn.com/how-to-use-custom-events-in-unreal-engine-4/" title="How to use Custom Events in Unreal Engine 4">[...]</a></p>
<p>The post <a href="https://couchlearn.com/how-to-use-custom-events-in-unreal-engine-4/">How to use Custom Events in Unreal Engine 4</a> appeared first on <a href="https://couchlearn.com">Couch Learn</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>An essential part of developing games with Unreal Engine 4 is learning Custom Events. <br><br><strong>Custom events are used to run a set of blueprint nodes on demand.</strong><br><br>Custom events are different from Functions as they can contain delay nodes and are created in the event graph.<br><br>In this guide we are learning how to create, setup and call custom events in Unreal Engine 4.</p>



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



<p>To create a custom event, right click anywhere in your actor&#8217;s event graph and write &#8220;Custom Event&#8221;.<br><br>Then click &#8220;Add Custom Event&#8221;.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="410" height="184" src="https://couchlearn.com/wp-content/uploads/2021/01/image-33.png" alt="Adding the custom event" class="wp-image-1422" srcset="https://couchlearn.com/wp-content/uploads/2021/01/image-33.png 410w, https://couchlearn.com/wp-content/uploads/2021/01/image-33-300x135.png 300w" sizes="(max-width: 410px) 100vw, 410px" /></figure>



<p>Once created, name the new custom event. <br><br><strong>It&#8217;s good practise to name your custom event based on its purpose.</strong></p>



<figure class="wp-block-image size-large"><img decoding="async" width="189" height="116" src="https://couchlearn.com/wp-content/uploads/2021/01/image-34.png" alt="Naming the newly created custom event" class="wp-image-1423"/></figure>



<p>Your event has now been created! <br><br>For this guide we named our custom event &#8220;My Custom Event&#8221;.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="176" height="92" src="https://couchlearn.com/wp-content/uploads/2021/01/image-35.png" alt="Created event named &quot;My Custom Event&quot;" class="wp-image-1424"/></figure>



<h3 class="wp-block-heading">Adding Inputs</h3>



<p>Similar to functions, custom events can have input variables attached to them.<br><br><strong>These are used to send information to the nodes running from the custom event.</strong><br><br>To add an input firstly click your custom event in the event graph and look to the right side of the screen.<br><br>Click the &#8220;New Parameter&#8221; button shown below to add a new variable to the inputs list.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="381" height="279" src="https://couchlearn.com/wp-content/uploads/2021/01/image-40.png" alt="Adding a new input to the custom event" class="wp-image-1432" srcset="https://couchlearn.com/wp-content/uploads/2021/01/image-40.png 381w, https://couchlearn.com/wp-content/uploads/2021/01/image-40-300x220.png 300w" sizes="(max-width: 381px) 100vw, 381px" /></figure>



<p>Then change the name of the input. The left side text box is the name that will be displayed inside the custom event.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="378" height="267" src="https://couchlearn.com/wp-content/uploads/2021/01/image-41.png" alt="Renaming the added input variable" class="wp-image-1433" srcset="https://couchlearn.com/wp-content/uploads/2021/01/image-41.png 378w, https://couchlearn.com/wp-content/uploads/2021/01/image-41-300x212.png 300w" sizes="(max-width: 378px) 100vw, 378px" /></figure>



<p>On the right side we can then change the input variables type. <br><br>We are changing this variable from Boolean to String. This means we can use text values in our input.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="484" height="597" src="https://couchlearn.com/wp-content/uploads/2021/01/image-43.png" alt="Changing the new variable to be a string" class="wp-image-1435" srcset="https://couchlearn.com/wp-content/uploads/2021/01/image-43.png 484w, https://couchlearn.com/wp-content/uploads/2021/01/image-43-243x300.png 243w" sizes="(max-width: 484px) 100vw, 484px" /><figcaption>When making your own custom events you can use any of the variable types shown.</figcaption></figure>



<p>The finished custom event input should now look like this.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="382" height="266" src="https://couchlearn.com/wp-content/uploads/2021/01/image-44.png" alt="finished input variables for the custom event" class="wp-image-1437" srcset="https://couchlearn.com/wp-content/uploads/2021/01/image-44.png 382w, https://couchlearn.com/wp-content/uploads/2021/01/image-44-300x209.png 300w" sizes="(max-width: 382px) 100vw, 382px" /></figure>



<p>The custom event in the event graph will now look like this.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="177" height="123" src="https://couchlearn.com/wp-content/uploads/2021/01/image-45.png" alt="finished custom event" class="wp-image-1439"/></figure>



<h3 class="wp-block-heading">Using your Custom Event</h3>



<p>Now that are custom event is created and the input variable has been setup, we can now create a &#8220;Print String&#8221; node to display the value of &#8220;My New Input&#8221; on the screen.<br><br><strong>This is the easiest way to test if the custom event is working correctly.</strong></p>



<figure class="wp-block-image size-large"><img decoding="async" width="611" height="189" src="https://couchlearn.com/wp-content/uploads/2021/01/image-46.png" alt="Creating a print string node to test the custom event input value." class="wp-image-1440" srcset="https://couchlearn.com/wp-content/uploads/2021/01/image-46.png 611w, https://couchlearn.com/wp-content/uploads/2021/01/image-46-300x93.png 300w" sizes="(max-width: 611px) 100vw, 611px" /></figure>



<p>Once the &#8220;Print String&#8221; node is created, connect the &#8220;My New Input&#8221; variable from your custom event to the In String pin on the Print String node.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="329" height="159" src="https://couchlearn.com/wp-content/uploads/2021/01/image-48.png" alt="Connecting the input variable to the In String value on the print string." class="wp-image-1443" srcset="https://couchlearn.com/wp-content/uploads/2021/01/image-48.png 329w, https://couchlearn.com/wp-content/uploads/2021/01/image-48-300x145.png 300w" sizes="(max-width: 329px) 100vw, 329px" /></figure>



<p>To run your custom event simply create a &#8220;Event BeginPlay&#8221; node, drag from the execution pin and type the name of your new custom event. In our case this is &#8220;My Custom Event&#8221;.<br><br>As your custom event is connected to an execution pin, it is now being called by the other event.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="616" height="156" src="https://couchlearn.com/wp-content/uploads/2021/01/image-36.png" alt="On begin play calling the new custom event." class="wp-image-1425" srcset="https://couchlearn.com/wp-content/uploads/2021/01/image-36.png 616w, https://couchlearn.com/wp-content/uploads/2021/01/image-36-300x76.png 300w" sizes="(max-width: 616px) 100vw, 616px" /></figure>



<p>Now that your custom event is being called by the BeginPlay event you can see the input variable. <br><br><strong>This input variable pin can be connected to any variable with the same type.</strong></p>



<figure class="wp-block-image size-large"><img decoding="async" width="417" height="153" src="https://couchlearn.com/wp-content/uploads/2021/01/image-49.png" alt="Connecting the my custom event to the begin play node." class="wp-image-1444" srcset="https://couchlearn.com/wp-content/uploads/2021/01/image-49.png 417w, https://couchlearn.com/wp-content/uploads/2021/01/image-49-300x110.png 300w" sizes="(max-width: 417px) 100vw, 417px" /></figure>



<p>We can now write any text into the My New Input variable.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="422" height="171" src="https://couchlearn.com/wp-content/uploads/2021/01/image-50.png" alt="Writing my custom event works in the my custom event node." class="wp-image-1445" srcset="https://couchlearn.com/wp-content/uploads/2021/01/image-50.png 422w, https://couchlearn.com/wp-content/uploads/2021/01/image-50-300x122.png 300w" sizes="(max-width: 422px) 100vw, 422px" /></figure>



<h3 class="wp-block-heading">Testing the Custom Event</h3>



<p>Running the game will now show the text that we wrote in the custom event.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="398" height="239" src="https://couchlearn.com/wp-content/uploads/2021/01/image-51.png" alt="The custom event runs correctly and prints the text on the screen." class="wp-image-1446" srcset="https://couchlearn.com/wp-content/uploads/2021/01/image-51.png 398w, https://couchlearn.com/wp-content/uploads/2021/01/image-51-300x180.png 300w" sizes="(max-width: 398px) 100vw, 398px" /></figure>



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



<p>Now you have the knowledge to create and use custom events in Unreal Engine 4!<br><br>Custom events are an essential component of Unreal Engine and are especially important for multiplayer game creation using blueprints.<br><br>Below are a few links for the full custom event documentation and a guide for using custom events and other Unreal Engine 4 features to make a multiplayer damage and health system.<br><br><a href="https://docs.unrealengine.com/en-US/ProgrammingAndScripting/Blueprints/UserGuide/Events/Custom/index.html">Click here to read the official documentation on Custom Events in Unreal Engine 4</a><br><br><a href="https://couchlearn.com/multiplayer-damage-and-health-system-in-unreal-engine-4/">Click here to see our guide on making a multiplayer ready damage and health system with custom events.</a></p>
<p>The post <a href="https://couchlearn.com/how-to-use-custom-events-in-unreal-engine-4/">How to use Custom Events 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-custom-events-in-unreal-engine-4/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Basic First Person Line Trace in Unreal Engine 4</title>
		<link>https://couchlearn.com/basic-first-person-line-trace-in-unreal-engine-4/</link>
					<comments>https://couchlearn.com/basic-first-person-line-trace-in-unreal-engine-4/#respond</comments>
		
		<dc:creator><![CDATA[Matt]]></dc:creator>
		<pubDate>Wed, 05 Aug 2020 13:06:16 +0000</pubDate>
				<category><![CDATA[Medium Difficulty]]></category>
		<category><![CDATA[UE4 Basics]]></category>
		<category><![CDATA[Unreal Basics]]></category>
		<category><![CDATA[Unreal Engine]]></category>
		<category><![CDATA[line trace]]></category>
		<category><![CDATA[ue4]]></category>
		<category><![CDATA[ue4 basics]]></category>
		<category><![CDATA[ue4 first person]]></category>
		<category><![CDATA[ue4 first person line trace]]></category>
		<category><![CDATA[ue4 fps]]></category>
		<category><![CDATA[ue4 line trace]]></category>
		<category><![CDATA[ue4 raycast]]></category>
		<category><![CDATA[ue4 trace]]></category>
		<category><![CDATA[unreal engine]]></category>
		<category><![CDATA[unreal engine 4]]></category>
		<category><![CDATA[unreal engine fps]]></category>
		<guid isPermaLink="false">https://couchlearn.com/?p=1215</guid>

					<description><![CDATA[<p>In this guide we will explain what a Line Trace is an how to create a Basic First Person Line Trace in Unreal Engine 4 <a class="mh-excerpt-more" href="https://couchlearn.com/basic-first-person-line-trace-in-unreal-engine-4/" title="Basic First Person Line Trace in Unreal Engine 4">[...]</a></p>
<p>The post <a href="https://couchlearn.com/basic-first-person-line-trace-in-unreal-engine-4/">Basic First Person Line Trace in Unreal Engine 4</a> appeared first on <a href="https://couchlearn.com">Couch Learn</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>In this guide we will explain what a Line Trace is an how to create a Basic First Person Line Trace in Unreal Engine 4<br><br><strong>This guide builds upon the First Person Example template built into Unreal Engine 4.</strong></p>



<h3 class="wp-block-heading">How a Line Trace Works</h3>



<p>A line trace is a way to check if an object is intersecting a line. The hit data is then broken down access more information such as location of hit, normal of hit. the actor that was hit and distance from hit.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="719" height="480" src="https://couchlearn.com/wp-content/uploads/2020/08/image-22.png" alt="An example of a line trace hitting a first person character" class="wp-image-1229" srcset="https://couchlearn.com/wp-content/uploads/2020/08/image-22.png 719w, https://couchlearn.com/wp-content/uploads/2020/08/image-22-300x200.png 300w" sizes="(max-width: 719px) 100vw, 719px" /></figure>



<h3 class="wp-block-heading">Different Types of Line Traces</h3>



<p>&#8220;Line Trace for Objects&#8221; checks an intersection with a specific collision object type. (WorldStatic, WorldDynamic, Pawn, Ragdoll, PhysicsActor, etc)</p>



<figure class="wp-block-image size-large"><img decoding="async" width="381" height="465" src="https://couchlearn.com/wp-content/uploads/2020/08/image-23.png" alt="Calculate a line trace by collision object type" class="wp-image-1230" srcset="https://couchlearn.com/wp-content/uploads/2020/08/image-23.png 381w, https://couchlearn.com/wp-content/uploads/2020/08/image-23-246x300.png 246w" sizes="(max-width: 381px) 100vw, 381px" /></figure>



<p>&#8220;Line Trace by Channel&#8221; checks for an intersection with a specific line trace collision channel. (Visibility and Camera are the default options)</p>



<figure class="wp-block-image size-large"><img decoding="async" width="350" height="383" src="https://couchlearn.com/wp-content/uploads/2020/08/image-24.png" alt="Calculate a line trace by trace channel" class="wp-image-1231" srcset="https://couchlearn.com/wp-content/uploads/2020/08/image-24.png 350w, https://couchlearn.com/wp-content/uploads/2020/08/image-24-274x300.png 274w" sizes="(max-width: 350px) 100vw, 350px" /></figure>



<p>&#8220;Line Trace by Channel&#8221; checks for an intersection with a specific collision profile by name. (These can be viewed and created in the collision tab of the project settings)</p>



<figure class="wp-block-image size-large"><img decoding="async" width="349" height="353" src="https://couchlearn.com/wp-content/uploads/2020/08/image-25.png" alt="Calculate a line trace by collision profile" class="wp-image-1232" srcset="https://couchlearn.com/wp-content/uploads/2020/08/image-25.png 349w, https://couchlearn.com/wp-content/uploads/2020/08/image-25-297x300.png 297w" sizes="(max-width: 349px) 100vw, 349px" /></figure>



<h3 class="wp-block-heading">How to Calculate the First Person Line Trace</h3>



<p>All line traces have the same basic setup. The nodes below setup the vector maths required to check for any collisions wherever the camera is located and facing.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="599" height="332" src="https://couchlearn.com/wp-content/uploads/2020/08/image-17.png" alt="The universal setup for all first person line traces" class="wp-image-1222" srcset="https://couchlearn.com/wp-content/uploads/2020/08/image-17.png 599w, https://couchlearn.com/wp-content/uploads/2020/08/image-17-300x166.png 300w" sizes="(max-width: 599px) 100vw, 599px" /></figure>



<h4 class="wp-block-heading">Breaking down the Maths</h4>



<p>Firstly you use the FirstPersonCamera variable connected to the GetWorldLocation node to begin the line trace from your character&#8217;s camera position.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="227" height="129" src="https://couchlearn.com/wp-content/uploads/2020/08/image-18.png" alt="Getting the world location of the first person camera" class="wp-image-1223"/></figure>



<p>Next using the Get Controller node, get the controller rotation from the Get Control Rotation node. This will get the rotation of your camera and even works multiplayer games.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="232" height="164" src="https://couchlearn.com/wp-content/uploads/2020/08/image-19.png" alt="Getting the control rotation for multiplayer compatibility" class="wp-image-1224"/></figure>



<p>Afterwards connect the Get Control Rotation node to the Get Forward Vector node. This will get the direction your camera is facing of your camera.<br><br>Multiply this Get Forward Vector value by 5000 (Multiple Vector by Float) to get a point in space from 0,0,0 that is 5000 units away facing the direction of the camera.<br><em>(This is the distance away from the camera to check fora collision. Change this to whichever distance you need for your project).</em><br><br>Finally add the Get World Location return value of your First Person Camera to the multiplied value. This gets the point in 3D space that you are looking at 5000 units in front of your camera.</p>



<h3 class="wp-block-heading">Accessing the Hit Data</h3>



<p>Connecting the return value to a branch only allows successful line traces to be accessed. Not including this branch will cause lots of console errors when accessing the hit result data.<br><br>To access this data click and drag from the Out Hit value and create a Break Hit Result node.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="729" height="489" src="https://couchlearn.com/wp-content/uploads/2020/08/image-20.png" alt="Accessing the data from a line trace" class="wp-image-1226" srcset="https://couchlearn.com/wp-content/uploads/2020/08/image-20.png 729w, https://couchlearn.com/wp-content/uploads/2020/08/image-20-300x201.png 300w" sizes="(max-width: 729px) 100vw, 729px" /></figure>



<h3 class="wp-block-heading">The Complete First Person Line Trace</h3>



<p>This is one example of a complete first person line trace. <br><br>To use this system simply connect the execution pins to any event you want e.g. Event Tick or an event</p>



<figure class="wp-block-image size-large"><img decoding="async" width="967" height="376" src="https://couchlearn.com/wp-content/uploads/2020/08/image-16.png" alt="An example of a complete first person line trace" class="wp-image-1221" srcset="https://couchlearn.com/wp-content/uploads/2020/08/image-16.png 967w, https://couchlearn.com/wp-content/uploads/2020/08/image-16-300x117.png 300w, https://couchlearn.com/wp-content/uploads/2020/08/image-16-768x299.png 768w" sizes="(max-width: 967px) 100vw, 967px" /></figure>



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



<p>Your project now is setup to use a basic First Person Line Trace in Unreal Engine 4!<br><br>Your project can now detect when objects are in front of the camera. Many use this system for weapons, interacting with objects such as doors, pickups and much more!<br><br><strong>Further Reading</strong>:<br><br>Combine this line trace system with our easy AI movement guide to create computer controlled character that can interact with objects! <a href="https://couchlearn.com/easy-ai-movement-in-unreal-engine-4/">https://couchlearn.com/easy-ai-movement-in-unreal-engine-4/</a><br><br>Unreal Engine&#8217;s documentation on single line traces: <a href="https://docs.unrealengine.com/en-US/Engine/Physics/Tracing/HowTo/SingleLineTraceByChannel/index.html">https://docs.unrealengine.com/en-US/Engine/Physics/Tracing/HowTo/SingleLineTraceByChannel/index.html</a><br><br>Unreal Engine&#8217;s full documentation on traces: <a href="https://docs.unrealengine.com/en-US/Engine/Physics/Tracing/Overview/index.html">https://docs.unrealengine.com/en-US/Engine/Physics/Tracing/Overview/index.html</a></p>
<p>The post <a href="https://couchlearn.com/basic-first-person-line-trace-in-unreal-engine-4/">Basic First Person Line Trace in Unreal Engine 4</a> appeared first on <a href="https://couchlearn.com">Couch Learn</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://couchlearn.com/basic-first-person-line-trace-in-unreal-engine-4/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Enums in Unreal Engine 4 Blueprints</title>
		<link>https://couchlearn.com/enums-in-unreal-engine-4-blueprints/</link>
					<comments>https://couchlearn.com/enums-in-unreal-engine-4-blueprints/#respond</comments>
		
		<dc:creator><![CDATA[Matt]]></dc:creator>
		<pubDate>Tue, 14 Jul 2020 14:43:15 +0000</pubDate>
				<category><![CDATA[Easy Difficulty]]></category>
		<category><![CDATA[UE4 Basics]]></category>
		<category><![CDATA[Unreal Basics]]></category>
		<category><![CDATA[Unreal Engine]]></category>
		<category><![CDATA[enum]]></category>
		<category><![CDATA[ue4]]></category>
		<category><![CDATA[ue4 enum]]></category>
		<category><![CDATA[ue4 enums]]></category>
		<category><![CDATA[unreal engine]]></category>
		<category><![CDATA[unreal engine 4]]></category>
		<category><![CDATA[unreal engine 4 enum]]></category>
		<guid isPermaLink="false">https://couchlearn.com/?p=1000</guid>

					<description><![CDATA[<p>In this guide we will be going over what Enums are in Unreal Engine 4 and how they are used in engine. What is an <a class="mh-excerpt-more" href="https://couchlearn.com/enums-in-unreal-engine-4-blueprints/" title="Enums in Unreal Engine 4 Blueprints">[...]</a></p>
<p>The post <a href="https://couchlearn.com/enums-in-unreal-engine-4-blueprints/">Enums in Unreal Engine 4 Blueprints</a> appeared first on <a href="https://couchlearn.com">Couch Learn</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>In this guide we will be going over what Enums are in Unreal Engine 4 and how they are used in engine.</p>



<h3 class="wp-block-heading">What is an Enum?</h3>



<p>An Enum (also known as Enumeration) is used to give names to integer values.<br><br>For example, a basic game menu state can be represented as names and programmed as integer numbers.<br><br>&#8211; 0 = Mainmenu<br>&#8211; 1 = Game<br>&#8211; 2 = Pause<br>&#8211; 3 = Gameover<br><br>All game engines can use enums as they are a basic programming feature. Unreal engine can use enums in c++ and blueprints. <br><br>In the next section we will be creating our own Enum in Unreal Engine 4 Blueprints.</p>



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



<p>Firstly, right click the content browser and hover over the blueprints tab. <br><br><strong>Click the Enumeration button to make the enum.</strong></p>



<figure class="wp-block-image size-large"><img decoding="async" width="774" height="413" src="https://couchlearn.com/wp-content/uploads/2020/01/image.png" alt="Creating the new enum asset" class="wp-image-1010" srcset="https://couchlearn.com/wp-content/uploads/2020/01/image.png 774w, https://couchlearn.com/wp-content/uploads/2020/01/image-300x160.png 300w, https://couchlearn.com/wp-content/uploads/2020/01/image-768x410.png 768w" sizes="(max-width: 774px) 100vw, 774px" /></figure>



<p>Secondly, add the names that you need for your enum.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="316" height="285" src="https://couchlearn.com/wp-content/uploads/2020/05/image-5.png" alt="Adding new values to the enum" class="wp-image-1176" srcset="https://couchlearn.com/wp-content/uploads/2020/05/image-5.png 316w, https://couchlearn.com/wp-content/uploads/2020/05/image-5-300x271.png 300w" sizes="(max-width: 316px) 100vw, 316px" /></figure>



<p>In this example we will be using mainmenu, game, pause and gameover.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="465" height="388" src="https://couchlearn.com/wp-content/uploads/2020/05/image-6.png" alt="All the values added to the enum for this guide" class="wp-image-1177" srcset="https://couchlearn.com/wp-content/uploads/2020/05/image-6.png 465w, https://couchlearn.com/wp-content/uploads/2020/05/image-6-300x250.png 300w" sizes="(max-width: 465px) 100vw, 465px" /></figure>



<h3 class="wp-block-heading">Using the Enum</h3>



<p>Lastly, with your new ENUM we can trigger different logic based on the value.<br><br>This can be done easily using a switch node. <br><br>Right click in any blueprint class and type &#8220;Switch on YOUR-ENUM-NAME&#8221;. In this case the node is called &#8220;Switch on gamestate&#8221;.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="807" height="587" src="https://couchlearn.com/wp-content/uploads/2020/07/image.png" alt="Running different blueprint nodes based on the enum gamestate" class="wp-image-1187" srcset="https://couchlearn.com/wp-content/uploads/2020/07/image.png 807w, https://couchlearn.com/wp-content/uploads/2020/07/image-300x218.png 300w, https://couchlearn.com/wp-content/uploads/2020/07/image-768x559.png 768w" sizes="(max-width: 807px) 100vw, 807px" /></figure>



<p><a href="https://couchlearn.com/switch-statements-in-unreal-engine-4/"><strong>If you don&#8217;t know how to use switch nodes check out our guide here.</strong></a></p>



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



<p>Now you have a working blueprint enum in Unreal Engine 4!<br><br>Even though this guide is short, We felt it was essential as there are very few guides for creating and using enums in blueprints.<br><br>Enums are extremely useful and most projects have many uses.<br><br>In future guides we will be using enums frequently which is why this guide is important for the future content of the site!<br><br>If you have any suggestions for future guides and projects, let us know by sending a comment below or by <a href="https://couchlearn.com/contact-us/">contacting us.</a><br><br><strong>Further Resources</strong>:<br><a href="https://couchlearn.com/contact-us/">Unreal Engine 4 official enum video (2014)</a><br><a href="https://couchlearn.com/switch-statements-in-unreal-engine-4/">Our guide on Switch nodes in Unreal Engine 4</a></p>
<p>The post <a href="https://couchlearn.com/enums-in-unreal-engine-4-blueprints/">Enums in Unreal Engine 4 Blueprints</a> appeared first on <a href="https://couchlearn.com">Couch Learn</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://couchlearn.com/enums-in-unreal-engine-4-blueprints/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to Unlock FPS in Unreal Engine 4</title>
		<link>https://couchlearn.com/how-to-unlock-fps-in-unreal-engine-4/</link>
					<comments>https://couchlearn.com/how-to-unlock-fps-in-unreal-engine-4/#respond</comments>
		
		<dc:creator><![CDATA[Matt]]></dc:creator>
		<pubDate>Thu, 06 Feb 2020 17:42:33 +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]]></category>
		<category><![CDATA[ue4 console commands]]></category>
		<category><![CDATA[ue4 fixed frame rate]]></category>
		<category><![CDATA[ue4 fps]]></category>
		<category><![CDATA[ue4 framerate smooth]]></category>
		<category><![CDATA[ue4 max fps]]></category>
		<category><![CDATA[ue4 unlock fps]]></category>
		<category><![CDATA[ue4 vsync]]></category>
		<category><![CDATA[unreal engine]]></category>
		<category><![CDATA[unreal engine 4]]></category>
		<category><![CDATA[unreal engine 4 fps]]></category>
		<guid isPermaLink="false">https://couchlearn.com/?p=1043</guid>

					<description><![CDATA[<p>By default, Unreal Engine 4 is setup to aim for a smooth 60fps performance in every project. With a few easy steps you can change <a class="mh-excerpt-more" href="https://couchlearn.com/how-to-unlock-fps-in-unreal-engine-4/" title="How to Unlock FPS in Unreal Engine 4">[...]</a></p>
<p>The post <a href="https://couchlearn.com/how-to-unlock-fps-in-unreal-engine-4/">How to Unlock FPS in Unreal Engine 4</a> appeared first on <a href="https://couchlearn.com">Couch Learn</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>By default, Unreal Engine 4 is setup to aim for a smooth 60fps performance in every project.<br><br>With a few easy steps you can change these default settings to run your project at over 240fps.<br><br>In this guide we will go through how to unlock FPS in Unreal Engine 4.</p>



<h3 class="wp-block-heading">Updating the Project Settings</h3>



<p>Firstly, open the project settings menu found in the Edit tab of the editor.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="597" height="456" src="https://couchlearn.com/wp-content/uploads/2020/01/image-11.png" alt="project settings" class="wp-image-1062" srcset="https://couchlearn.com/wp-content/uploads/2020/01/image-11.png 597w, https://couchlearn.com/wp-content/uploads/2020/01/image-11-300x229.png 300w" sizes="(max-width: 597px) 100vw, 597px" /></figure>



<p>Once the project settings menu is open, click the general settings option.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="420" height="545" src="https://couchlearn.com/wp-content/uploads/2020/01/image-12.png" alt="general settings" class="wp-image-1063" srcset="https://couchlearn.com/wp-content/uploads/2020/01/image-12.png 420w, https://couchlearn.com/wp-content/uploads/2020/01/image-12-231x300.png 231w" sizes="(max-width: 420px) 100vw, 420px" /></figure>



<p>Now you can access the framerate options.</p>



<h4 class="wp-block-heading">Fixed Framerate</h4>



<p>To make sure that the frame rate can go above the limit, disable Use Fixed Frame Rate.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="512" height="195" src="https://couchlearn.com/wp-content/uploads/2020/01/image-7.png" alt="disabling the fixed frame rate" class="wp-image-1052" srcset="https://couchlearn.com/wp-content/uploads/2020/01/image-7.png 512w, https://couchlearn.com/wp-content/uploads/2020/01/image-7-300x114.png 300w" sizes="(max-width: 512px) 100vw, 512px" /></figure>



<h4 class="wp-block-heading">FPS Smoothing</h4>



<p>Smooth Frame Rate will try to make your FPS consistent in the range that you set. <br><br>Disabling this will prevent UE4 from adjusting your frame rate.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="534" height="194" src="https://couchlearn.com/wp-content/uploads/2020/01/image-8.png" alt="disabling smooth frame rate" class="wp-image-1053" srcset="https://couchlearn.com/wp-content/uploads/2020/01/image-8.png 534w, https://couchlearn.com/wp-content/uploads/2020/01/image-8-300x109.png 300w" sizes="(max-width: 534px) 100vw, 534px" /></figure>



<h3 class="wp-block-heading">Console Commands and Game Settings</h3>



<p>These settings can be changed in any blueprint. In this example we used the level blueprint.</p>



<h4 class="wp-block-heading">Disable VSync</h4>



<p>Using Unreal Engine 4&#8217;s game user settings, VSync (vertical sync) can be disabled. <br><br>Vertical sync locks the frame rate of the game to 60fps.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="467" height="149" src="https://couchlearn.com/wp-content/uploads/2020/01/image-10.png" alt="disabling vsync" class="wp-image-1058" srcset="https://couchlearn.com/wp-content/uploads/2020/01/image-10.png 467w, https://couchlearn.com/wp-content/uploads/2020/01/image-10-300x96.png 300w" sizes="(max-width: 467px) 100vw, 467px" /></figure>



<h4 class="wp-block-heading">Set Max Framerate</h4>



<p>Using the Execute Console Command node we can enable the console command <strong>t.maxfps</strong>. <br><br>This command tells the engine what the maximum frame rate cap should be.<br><br><strong>The number after the command is the frame rate cap. </strong><br><br><strong>This can be as high or as low as your project requires.</strong></p>



<figure class="wp-block-image size-large"><img decoding="async" width="410" height="132" src="https://couchlearn.com/wp-content/uploads/2020/01/image-9.png" alt="changing the maxfps console variable" class="wp-image-1057" srcset="https://couchlearn.com/wp-content/uploads/2020/01/image-9.png 410w, https://couchlearn.com/wp-content/uploads/2020/01/image-9-300x97.png 300w" sizes="(max-width: 410px) 100vw, 410px" /></figure>



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



<p>With these settings enabled, your project can now reach the maximum performance without limits or frame rate locks.<br><br>For more information on this topic, read the documentation linked below from the official Unreal Engine site.<br><br>Further resources:<br><a href="https://docs.unrealengine.com/en-US/Engine/Performance/SmoothFrameRate/index.html">Smooth frame rate documentation from Unreal Docs</a><br><a href="https://docs.unrealengine.com/en-US/Engine/Performance/index.html">Performance and profiling documentation from Unreal Docs </a></p>
<p>The post <a href="https://couchlearn.com/how-to-unlock-fps-in-unreal-engine-4/">How to Unlock FPS 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-unlock-fps-in-unreal-engine-4/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Show FPS Counter in Unreal Engine 4</title>
		<link>https://couchlearn.com/show-fps-counter-in-unreal-engine-4/</link>
					<comments>https://couchlearn.com/show-fps-counter-in-unreal-engine-4/#respond</comments>
		
		<dc:creator><![CDATA[Matt]]></dc:creator>
		<pubDate>Mon, 06 Jan 2020 01:56:11 +0000</pubDate>
				<category><![CDATA[Easy Difficulty]]></category>
		<category><![CDATA[UE4 Basics]]></category>
		<category><![CDATA[Unreal Basics]]></category>
		<category><![CDATA[Unreal Engine]]></category>
		<category><![CDATA[fps]]></category>
		<category><![CDATA[show framerate]]></category>
		<category><![CDATA[ue4]]></category>
		<category><![CDATA[ue4 stat]]></category>
		<category><![CDATA[unreal engine]]></category>
		<category><![CDATA[unreal engine 4]]></category>
		<category><![CDATA[unreal engine stat]]></category>
		<guid isPermaLink="false">https://couchlearn.com/?p=1017</guid>

					<description><![CDATA[<p>One essential debugging feature in any game engine is the frame rate counter also known as the FPS counter. In this quick guide we will <a class="mh-excerpt-more" href="https://couchlearn.com/show-fps-counter-in-unreal-engine-4/" title="Show FPS Counter in Unreal Engine 4">[...]</a></p>
<p>The post <a href="https://couchlearn.com/show-fps-counter-in-unreal-engine-4/">Show FPS Counter in Unreal Engine 4</a> appeared first on <a href="https://couchlearn.com">Couch Learn</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>One essential debugging feature in any game engine is the frame rate counter also known as the FPS counter.<br><br>In this quick guide we will show you how to enable this feature inside Unreal Engine 4 and how to show this counter while the game is being played; even after packaging.</p>



<h3 class="wp-block-heading">Framerate in the Editor</h3>



<p>To show the fps counter inside the editor, firstly press the small arrow button on the top left of the viewport.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="492" src="https://couchlearn.com/wp-content/uploads/2020/01/image-1-1024x492.png" alt="Opening the dropdown box in the top left corner of the viewport." class="wp-image-1018" srcset="https://couchlearn.com/wp-content/uploads/2020/01/image-1-1024x492.png 1024w, https://couchlearn.com/wp-content/uploads/2020/01/image-1-300x144.png 300w, https://couchlearn.com/wp-content/uploads/2020/01/image-1-768x369.png 768w, https://couchlearn.com/wp-content/uploads/2020/01/image-1.png 1361w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>On this new menu, in the viewport options section, tick the &#8220;Show FPS&#8221; box.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="552" src="https://couchlearn.com/wp-content/uploads/2020/01/image-2-1024x552.png" alt="Enabling the fps counter in the viewport." class="wp-image-1019" srcset="https://couchlearn.com/wp-content/uploads/2020/01/image-2-1024x552.png 1024w, https://couchlearn.com/wp-content/uploads/2020/01/image-2-300x162.png 300w, https://couchlearn.com/wp-content/uploads/2020/01/image-2-768x414.png 768w, https://couchlearn.com/wp-content/uploads/2020/01/image-2.png 1373w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p class="has-text-align-left">In the top right of the viewport, the fps counter is now displayed with the frame time below it. Frame time is the time taken to produce one frame.</p>



<p class="has-text-align-center"><strong>16.6ms is 60FPS</strong></p>



<figure class="wp-block-image size-large"><img decoding="async" width="347" height="188" src="https://couchlearn.com/wp-content/uploads/2020/01/image-3.png" alt="The FPS counter showing inside the editor." class="wp-image-1020" srcset="https://couchlearn.com/wp-content/uploads/2020/01/image-3.png 347w, https://couchlearn.com/wp-content/uploads/2020/01/image-3-300x163.png 300w" sizes="(max-width: 347px) 100vw, 347px" /></figure>



<h3 class="wp-block-heading">Framerate Counter in Game</h3>



<p>To show the fps counter inside your game, we will firstly add the F3 keypress event to our character blueprint.</p>



<p class="has-text-align-center"><strong>This can be any key</strong> <strong>you want</strong></p>



<figure class="wp-block-image size-large"><img decoding="async" width="793" height="395" src="https://couchlearn.com/wp-content/uploads/2020/01/image-4.png" alt="Adding the f3 key press event to the player character blueprint." class="wp-image-1021" srcset="https://couchlearn.com/wp-content/uploads/2020/01/image-4.png 793w, https://couchlearn.com/wp-content/uploads/2020/01/image-4-300x149.png 300w, https://couchlearn.com/wp-content/uploads/2020/01/image-4-768x383.png 768w" sizes="(max-width: 793px) 100vw, 793px" /></figure>



<p>From the pressed execution pin, create a new &#8220;Execute Console Command&#8221; node.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="773" height="357" src="https://couchlearn.com/wp-content/uploads/2020/01/image-5.png" alt="Adding the execute console command node to the f3 key press event" class="wp-image-1022" srcset="https://couchlearn.com/wp-content/uploads/2020/01/image-5.png 773w, https://couchlearn.com/wp-content/uploads/2020/01/image-5-300x139.png 300w, https://couchlearn.com/wp-content/uploads/2020/01/image-5-768x355.png 768w" sizes="(max-width: 773px) 100vw, 773px" /></figure>



<p>Inside the Execute Console Command node, type <em>stat fps</em> into the command box. This is the command which will be sent to the game to toggle the frame rate counter on and off.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="501" height="189" src="https://couchlearn.com/wp-content/uploads/2020/01/image-6.png" alt="Executing the stat fps console command" class="wp-image-1023" srcset="https://couchlearn.com/wp-content/uploads/2020/01/image-6.png 501w, https://couchlearn.com/wp-content/uploads/2020/01/image-6-300x113.png 300w" sizes="(max-width: 501px) 100vw, 501px" /></figure>



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



<p>In this demonstration we show the third person example project turning the fps counter on and off during the game.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1018" height="468" src="https://couchlearn.com/wp-content/uploads/2020/01/showfpsoptimised.gif" alt="The fps counter toggling on and off in the top right corner." class="wp-image-1024"/></figure>



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



<p>Your project now has access to the fps counter during editing and when you package your game into a standalone executable!<br><br>This fps counter will work correctly for all builds of the game including shipping builds.<br><br>There are many different stat commands that can display debug information to the player or tester.<br><br>Below are some links to further reading if you would like to look into the stat system further.<br><br><strong>Further Resources:<br></strong><a href="https://couchlearn.com/how-to-use-input-actions-and-input-axis-mappings-in-your-unreal-engine-4-game/">Improve this system with our guide on input actions and input axis.</a><br><br><a href="https://docs.unrealengine.com/en-US/Engine/Performance/StatCommands/index.html">Official Unreal Engine Statistics documentation.</a></p>
<p>The post <a href="https://couchlearn.com/show-fps-counter-in-unreal-engine-4/">Show FPS Counter in Unreal Engine 4</a> appeared first on <a href="https://couchlearn.com">Couch Learn</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://couchlearn.com/show-fps-counter-in-unreal-engine-4/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Switch Statements in Unreal Engine 4</title>
		<link>https://couchlearn.com/switch-statements-in-unreal-engine-4/</link>
					<comments>https://couchlearn.com/switch-statements-in-unreal-engine-4/#respond</comments>
		
		<dc:creator><![CDATA[Matt]]></dc:creator>
		<pubDate>Fri, 27 Dec 2019 02:24:42 +0000</pubDate>
				<category><![CDATA[Easy Difficulty]]></category>
		<category><![CDATA[UE4 Basics]]></category>
		<category><![CDATA[Unreal Basics]]></category>
		<category><![CDATA[Unreal Engine]]></category>
		<category><![CDATA[switch]]></category>
		<category><![CDATA[switch case]]></category>
		<category><![CDATA[switch on]]></category>
		<category><![CDATA[switch on int]]></category>
		<category><![CDATA[switch statement]]></category>
		<category><![CDATA[ue4]]></category>
		<category><![CDATA[ue4 switch]]></category>
		<category><![CDATA[ue4 switch case]]></category>
		<category><![CDATA[ue4 switch node]]></category>
		<category><![CDATA[ue4 switch on]]></category>
		<category><![CDATA[unreal engine 4]]></category>
		<guid isPermaLink="false">https://couchlearn.com/?p=576</guid>

					<description><![CDATA[<p>Switch statements are a useful and universal programming feature that also is included in Unreal Engine 4 blueprints. The use of switch nodes can replace <a class="mh-excerpt-more" href="https://couchlearn.com/switch-statements-in-unreal-engine-4/" title="Switch Statements in Unreal Engine 4">[...]</a></p>
<p>The post <a href="https://couchlearn.com/switch-statements-in-unreal-engine-4/">Switch Statements in Unreal Engine 4</a> appeared first on <a href="https://couchlearn.com">Couch Learn</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Switch statements are a useful and universal programming feature that also is included in Unreal Engine 4 blueprints.<br><br>The use of switch nodes can replace large chains of branches in your code, making  your blueprints cleaner and more organized.</p>



<p>In this guide we will be going over what Switch Statements are in Unreal Engine 4 and how they are used in engine.</p>



<h3 class="wp-block-heading">Switch and Case</h3>



<p>The switch statement takes in an input runs different code from that value.<br><br>The default value will run if the value doesn&#8217;t match.</p>



<p class="has-text-align-center"><strong>In this example we will setup the simplest switch node; Switch on Int.</strong></p>



<figure class="wp-block-image size-large"><img decoding="async" width="248" height="120" src="https://couchlearn.com/wp-content/uploads/2019/12/image.png" alt="" class="wp-image-984"/></figure>



<h4 class="wp-block-heading">Setting up a Switch Statement</h4>



<p>In Unreal Engine 4, new execution pins can be added by clicking on the node and looking in the details panel (on the right by default).</p>



<figure class="wp-block-image size-large"><img decoding="async" width="359" height="180" src="https://couchlearn.com/wp-content/uploads/2019/12/image-1.png" alt="" class="wp-image-985" srcset="https://couchlearn.com/wp-content/uploads/2019/12/image-1.png 359w, https://couchlearn.com/wp-content/uploads/2019/12/image-1-300x150.png 300w" sizes="(max-width: 359px) 100vw, 359px" /></figure>



<h4 class="wp-block-heading">Adding Functionality</h4>



<p>Once you have added the new pins we can attach blueprint nodes.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="265" height="239" src="https://couchlearn.com/wp-content/uploads/2019/12/image-2.png" alt="Switch on Int node" class="wp-image-986"/></figure>



<p>This blueprint code below will print different numbers on the screen based on the random integer.<br><br>If the random integer is 6 the code will output &#8220;Default&#8221;.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="679" height="751" src="https://couchlearn.com/wp-content/uploads/2019/12/image-5.png" alt="" class="wp-image-990" srcset="https://couchlearn.com/wp-content/uploads/2019/12/image-5.png 679w, https://couchlearn.com/wp-content/uploads/2019/12/image-5-271x300.png 271w" sizes="(max-width: 679px) 100vw, 679px" /></figure>



<h4 class="wp-block-heading">Demonstration</h4>



<figure class="wp-block-image size-large"><img decoding="async" width="224" height="263" src="https://couchlearn.com/wp-content/uploads/2019/12/image-6.png" alt="" class="wp-image-992"/></figure>



<h3 class="wp-block-heading">Examples of Other Switch Nodes</h3>



<h4 class="wp-block-heading">Switch on String</h4>



<p>This node allows you to set the output pins with a string. The output pin will fire if the selection string matches the pin name. </p>



<figure class="wp-block-image size-large"><img decoding="async" width="306" height="161" src="https://couchlearn.com/wp-content/uploads/2019/12/image-7.png" alt="Switch on String with your string as an output." class="wp-image-993" srcset="https://couchlearn.com/wp-content/uploads/2019/12/image-7.png 306w, https://couchlearn.com/wp-content/uploads/2019/12/image-7-300x158.png 300w" sizes="(max-width: 306px) 100vw, 306px" /></figure>



<p>This can also be case sensitive.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="388" height="171" src="https://couchlearn.com/wp-content/uploads/2019/12/image-8.png" alt="Change the new pin name" class="wp-image-994" srcset="https://couchlearn.com/wp-content/uploads/2019/12/image-8.png 388w, https://couchlearn.com/wp-content/uploads/2019/12/image-8-300x132.png 300w" sizes="(max-width: 388px) 100vw, 388px" /></figure>



<h4 class="wp-block-heading">Switch on Enum</h4>



<p>This node fires different output pins based on the custom enum value of selection.<br><br>In this example, I created a new enum named &#8220;Example Enum&#8221;.<br><br>A common use for this node would be for switching between states in your game e.g. Game, Main Menu and Credits shown below.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="407" height="146" src="https://couchlearn.com/wp-content/uploads/2019/12/image-9.png" alt="Switch on enum with execution pins" class="wp-image-996" srcset="https://couchlearn.com/wp-content/uploads/2019/12/image-9.png 407w, https://couchlearn.com/wp-content/uploads/2019/12/image-9-300x108.png 300w" sizes="(max-width: 407px) 100vw, 407px" /></figure>



<p>We are working on a guide on Enums in Unreal Engine 4. It will be linked here on completion.</p>



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



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



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



<p>Now you can organize and optimize your blueprints with switch nodes!<br><br>Even though this is a simple topic, it is extremely important for improving your overall blueprint code quality.<br><br><strong><em>Extra Reading:</em></strong><br><br><a href="https://docs.unrealengine.com/en-US/Engine/Blueprints/UserGuide/FlowControl/index.html#switchnodes">Click here for more information on switch statements in Unreal Engine 4. </a><br><br><a href="https://docs.unrealengine.com/en-US/Engine/Blueprints/UserGuide/FlowControl/index.html">Click here for more information on flow control in Unreal Engine 4.</a></p>
<p>The post <a href="https://couchlearn.com/switch-statements-in-unreal-engine-4/">Switch Statements in Unreal Engine 4</a> appeared first on <a href="https://couchlearn.com">Couch Learn</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://couchlearn.com/switch-statements-in-unreal-engine-4/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<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 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>
		<item>
		<title>How to use the Game Instance in Unreal Engine 4</title>
		<link>https://couchlearn.com/how-to-use-the-game-instance-in-unreal-engine-4/</link>
					<comments>https://couchlearn.com/how-to-use-the-game-instance-in-unreal-engine-4/#respond</comments>
		
		<dc:creator><![CDATA[Matt]]></dc:creator>
		<pubDate>Thu, 10 Oct 2019 16:21:42 +0000</pubDate>
				<category><![CDATA[Easy Difficulty]]></category>
		<category><![CDATA[UE4 Basics]]></category>
		<category><![CDATA[Unreal Basics]]></category>
		<category><![CDATA[Unreal Engine]]></category>
		<category><![CDATA[game instance]]></category>
		<category><![CDATA[player values]]></category>
		<category><![CDATA[saving over levels]]></category>
		<category><![CDATA[ue4]]></category>
		<category><![CDATA[ue4 game instance]]></category>
		<category><![CDATA[unreal engine]]></category>
		<category><![CDATA[unreal engine 4]]></category>
		<category><![CDATA[unreal engine 4 game instance]]></category>
		<guid isPermaLink="false">https://couchlearn.com/?p=775</guid>

					<description><![CDATA[<p>The Game Instance is one the most important blueprint classes in an Unreal Engine 4 game. In this guide we will go through what the <a class="mh-excerpt-more" href="https://couchlearn.com/how-to-use-the-game-instance-in-unreal-engine-4/" title="How to use the Game Instance in Unreal Engine 4">[...]</a></p>
<p>The post <a href="https://couchlearn.com/how-to-use-the-game-instance-in-unreal-engine-4/">How to use the Game Instance in Unreal Engine 4</a> appeared first on <a href="https://couchlearn.com">Couch Learn</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>The Game Instance is one the most important blueprint classes in an Unreal Engine 4 game. <br><br>In this guide we will go through what the Game Instance does and how to use the game instance in Unreal Engine 4.</p>



<figure class="wp-block-image"><img decoding="async" width="559" height="69" src="https://couchlearn.com/wp-content/uploads/2019/10/image-10.png" alt="game instance project settings value" class="wp-image-825" srcset="https://couchlearn.com/wp-content/uploads/2019/10/image-10.png 559w, https://couchlearn.com/wp-content/uploads/2019/10/image-10-416x51.png 416w, https://couchlearn.com/wp-content/uploads/2019/10/image-10-300x37.png 300w" sizes="(max-width: 559px) 100vw, 559px" /></figure>



<h3 class="wp-block-heading">What is the Game Instance</h3>



<p class="has-text-align-left">The game instance is a manager class that is not destroyed when changing levels in your game.<br><br>This means data such as player health, score, ammo and more can be stored between levels.</p>



<p class="has-text-align-center"><strong>The data is kept as long as the game is running.</strong><br><strong>Once you close your game the data is lost!</strong></p>



<figure class="wp-block-image"><img decoding="async" width="658" height="195" src="https://couchlearn.com/wp-content/uploads/2019/10/image-16.png" alt="Casting to the game instance created later in the guide" class="wp-image-832" srcset="https://couchlearn.com/wp-content/uploads/2019/10/image-16.png 658w, https://couchlearn.com/wp-content/uploads/2019/10/image-16-416x123.png 416w, https://couchlearn.com/wp-content/uploads/2019/10/image-16-300x89.png 300w" sizes="(max-width: 658px) 100vw, 658px" /></figure>



<h3 class="wp-block-heading">Creating your Game Instance</h3>



<h4 class="wp-block-heading">Creating the Class</h4>



<p>To create the Game Instance class, right click anywhere in your content browser at the bottom and click &#8216;Blueprint Class&#8217;.</p>



<figure class="wp-block-image"><img decoding="async" width="1024" height="650" src="https://couchlearn.com/wp-content/uploads/2019/10/image-1024x650.png" alt="Creating a new blueprint class" class="wp-image-815" srcset="https://couchlearn.com/wp-content/uploads/2019/10/image-1024x650.png 1024w, https://couchlearn.com/wp-content/uploads/2019/10/image-416x264.png 416w, https://couchlearn.com/wp-content/uploads/2019/10/image-300x191.png 300w, https://couchlearn.com/wp-content/uploads/2019/10/image-768x488.png 768w, https://couchlearn.com/wp-content/uploads/2019/10/image.png 1359w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>A new dialog box will show and ask which parent class you wish to make.</p>



<figure class="wp-block-image"><img decoding="async" width="544" height="442" src="https://couchlearn.com/wp-content/uploads/2019/10/image-1.png" alt="List of blueprint classes to potentially create" class="wp-image-816" srcset="https://couchlearn.com/wp-content/uploads/2019/10/image-1.png 544w, https://couchlearn.com/wp-content/uploads/2019/10/image-1-416x338.png 416w, https://couchlearn.com/wp-content/uploads/2019/10/image-1-300x244.png 300w" sizes="(max-width: 544px) 100vw, 544px" /></figure>



<p>To create the Game Instance class we need to click the &#8216;All Classes&#8217; drop down at the bottom.</p>



<figure class="wp-block-image"><img decoding="async" width="544" height="442" src="https://couchlearn.com/wp-content/uploads/2019/10/image-2.png" alt="Selecting all classes to spawn" class="wp-image-817" srcset="https://couchlearn.com/wp-content/uploads/2019/10/image-2.png 544w, https://couchlearn.com/wp-content/uploads/2019/10/image-2-416x338.png 416w, https://couchlearn.com/wp-content/uploads/2019/10/image-2-300x244.png 300w" sizes="(max-width: 544px) 100vw, 544px" /></figure>



<p>Clicking this will now show all the classes we can create.</p>



<figure class="wp-block-image"><img decoding="async" width="544" height="743" src="https://couchlearn.com/wp-content/uploads/2019/10/image-3.png" alt="Listing all blueprint classes to potentially create" class="wp-image-818" srcset="https://couchlearn.com/wp-content/uploads/2019/10/image-3.png 544w, https://couchlearn.com/wp-content/uploads/2019/10/image-3-416x568.png 416w, https://couchlearn.com/wp-content/uploads/2019/10/image-3-220x300.png 220w" sizes="(max-width: 544px) 100vw, 544px" /></figure>



<p>In the search box type Game Instance, click the GameInstance text and then click select to create our new Game Instance.</p>



<figure class="wp-block-image"><img decoding="async" width="544" height="554" src="https://couchlearn.com/wp-content/uploads/2019/10/image-4.png" alt="Selecting the game instance class to create" class="wp-image-819" srcset="https://couchlearn.com/wp-content/uploads/2019/10/image-4.png 544w, https://couchlearn.com/wp-content/uploads/2019/10/image-4-416x424.png 416w, https://couchlearn.com/wp-content/uploads/2019/10/image-4-295x300.png 295w" sizes="(max-width: 544px) 100vw, 544px" /></figure>



<p>Now after naming your new Game Instance, it will be shown in the content browser.</p>



<figure class="wp-block-image"><img decoding="async" width="331" height="191" src="https://couchlearn.com/wp-content/uploads/2019/10/image-5.png" alt="Renaming your new game instance class" class="wp-image-820" srcset="https://couchlearn.com/wp-content/uploads/2019/10/image-5.png 331w, https://couchlearn.com/wp-content/uploads/2019/10/image-5-300x173.png 300w" sizes="(max-width: 331px) 100vw, 331px" /></figure>



<h4 class="wp-block-heading">Adding Variables</h4>



<p>Firstly, to add variables to your new Game Instance, simply double click to open the blueprint editor.</p>



<figure class="wp-block-image"><img decoding="async" width="1024" height="288" src="https://couchlearn.com/wp-content/uploads/2019/10/image-6-1024x288.png" alt="Opening the game instance class" class="wp-image-821" srcset="https://couchlearn.com/wp-content/uploads/2019/10/image-6-1024x288.png 1024w, https://couchlearn.com/wp-content/uploads/2019/10/image-6-416x117.png 416w, https://couchlearn.com/wp-content/uploads/2019/10/image-6-300x84.png 300w, https://couchlearn.com/wp-content/uploads/2019/10/image-6-768x216.png 768w, https://couchlearn.com/wp-content/uploads/2019/10/image-6.png 1124w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>On the left hand side click the + Variable button to add a new variable.</p>



<figure class="wp-block-image"><img decoding="async" width="442" height="201" src="https://couchlearn.com/wp-content/uploads/2019/10/image-7.png" alt="Creating a new variable" class="wp-image-822" srcset="https://couchlearn.com/wp-content/uploads/2019/10/image-7.png 442w, https://couchlearn.com/wp-content/uploads/2019/10/image-7-416x189.png 416w, https://couchlearn.com/wp-content/uploads/2019/10/image-7-300x136.png 300w" sizes="(max-width: 442px) 100vw, 442px" /></figure>



<p>For this example I have created a Float variable called Health that has a default value of 100.</p>



<figure class="wp-block-image"><img decoding="async" width="477" height="459" src="https://couchlearn.com/wp-content/uploads/2019/10/image-8.png" alt="Creating the health variable" class="wp-image-823" srcset="https://couchlearn.com/wp-content/uploads/2019/10/image-8.png 477w, https://couchlearn.com/wp-content/uploads/2019/10/image-8-416x400.png 416w, https://couchlearn.com/wp-content/uploads/2019/10/image-8-300x289.png 300w" sizes="(max-width: 477px) 100vw, 477px" /></figure>



<p>When you are done creating your variables make sure to compile and save!</p>



<figure class="wp-block-image"><img decoding="async" width="153" height="72" src="https://couchlearn.com/wp-content/uploads/2019/10/image-9.png" alt="Compiling and saving the new changes" class="wp-image-824" srcset="https://couchlearn.com/wp-content/uploads/2019/10/image-9.png 153w, https://couchlearn.com/wp-content/uploads/2019/10/image-9-150x72.png 150w" sizes="(max-width: 153px) 100vw, 153px" /></figure>



<h3 class="wp-block-heading">Accessing your Game Instance</h3>



<h4 class="wp-block-heading">Configuring the Project Settings</h4>



<p>Firstly, before you can access your game instance, you will need to configure the game to use the new Game Instance that we just created.<br><br><strong>This is a very simple step and only takes a few clicks.</strong></p>



<p>Click edit in the top right, then click on Project Settings.</p>



<figure class="wp-block-image"><img decoding="async" width="638" height="445" src="https://couchlearn.com/wp-content/uploads/2019/10/image-11.png" alt="Opening the project settings" class="wp-image-826" srcset="https://couchlearn.com/wp-content/uploads/2019/10/image-11.png 638w, https://couchlearn.com/wp-content/uploads/2019/10/image-11-416x290.png 416w, https://couchlearn.com/wp-content/uploads/2019/10/image-11-300x209.png 300w" sizes="(max-width: 638px) 100vw, 638px" /></figure>



<p>Once the Project Settings window opens, search for the Maps &amp; Modes option and click on it.</p>



<figure class="wp-block-image"><img decoding="async" width="1024" height="689" src="https://couchlearn.com/wp-content/uploads/2019/10/image-12-1024x689.png" alt="Opening the maps and modes section" class="wp-image-827" srcset="https://couchlearn.com/wp-content/uploads/2019/10/image-12-1024x689.png 1024w, https://couchlearn.com/wp-content/uploads/2019/10/image-12-416x280.png 416w, https://couchlearn.com/wp-content/uploads/2019/10/image-12-300x202.png 300w, https://couchlearn.com/wp-content/uploads/2019/10/image-12-768x516.png 768w, https://couchlearn.com/wp-content/uploads/2019/10/image-12.png 1258w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>At the bottom of the Maps &amp; Modes section look for the Game Instance Class drop down box.<br><br>Click this box and select your new Game Instance class. In my case, I named mine GameInstanceDemo in the previous step.</p>



<figure class="wp-block-image"><img decoding="async" width="625" height="169" src="https://couchlearn.com/wp-content/uploads/2019/10/image-13.png" alt="Configuring your game instance into the project" class="wp-image-828" srcset="https://couchlearn.com/wp-content/uploads/2019/10/image-13.png 625w, https://couchlearn.com/wp-content/uploads/2019/10/image-13-416x112.png 416w, https://couchlearn.com/wp-content/uploads/2019/10/image-13-300x81.png 300w" sizes="(max-width: 625px) 100vw, 625px" /></figure>



<h4 class="wp-block-heading">Accessing and Setting the Variables</h4>



<p>To start using your Game Instance right click in any of your blueprints (characters, actors etc) and type get game instance.<br><br><strong>This will retrieve the game instance with your set variables.</strong></p>



<figure class="wp-block-image"><img decoding="async" width="410" height="105" src="https://couchlearn.com/wp-content/uploads/2019/10/image-14.png" alt="Get the game instance through a blueprint node" class="wp-image-829" srcset="https://couchlearn.com/wp-content/uploads/2019/10/image-14.png 410w, https://couchlearn.com/wp-content/uploads/2019/10/image-14-300x77.png 300w" sizes="(max-width: 410px) 100vw, 410px" /></figure>



<p>From the pin of the Get Game Instance node create a cast node to your newly created Game Instance Class. <br><br>This cast node is named the same as your Game Instance set earlier.</p>



<figure class="wp-block-image"><img decoding="async" width="658" height="195" src="https://couchlearn.com/wp-content/uploads/2019/10/image-15.png" alt="Casting to the game instance" class="wp-image-830" srcset="https://couchlearn.com/wp-content/uploads/2019/10/image-15.png 658w, https://couchlearn.com/wp-content/uploads/2019/10/image-15-416x123.png 416w, https://couchlearn.com/wp-content/uploads/2019/10/image-15-300x89.png 300w" sizes="(max-width: 658px) 100vw, 658px" /></figure>



<p>From this new cast node you can set and get the values of your Game Instance variables.</p>



<figure class="wp-block-image"><img decoding="async" width="649" height="265" src="https://couchlearn.com/wp-content/uploads/2019/10/image-17.png" alt="Get the health and setting the health variable values" class="wp-image-833" srcset="https://couchlearn.com/wp-content/uploads/2019/10/image-17.png 649w, https://couchlearn.com/wp-content/uploads/2019/10/image-17-416x170.png 416w, https://couchlearn.com/wp-content/uploads/2019/10/image-17-300x122.png 300w" sizes="(max-width: 649px) 100vw, 649px" /></figure>



<p> In this example I will set the health value to 50 and load a new level which will print out the value. This value will stay the same as the Game Instance values are kept over different levels. </p>



<figure class="wp-block-image"><img decoding="async" width="864" height="243" src="https://couchlearn.com/wp-content/uploads/2019/10/image-18.png" alt="Setting the health variable to 50 and opening the next test level" class="wp-image-834" srcset="https://couchlearn.com/wp-content/uploads/2019/10/image-18.png 864w, https://couchlearn.com/wp-content/uploads/2019/10/image-18-416x117.png 416w, https://couchlearn.com/wp-content/uploads/2019/10/image-18-300x84.png 300w, https://couchlearn.com/wp-content/uploads/2019/10/image-18-768x216.png 768w" sizes="(max-width: 864px) 100vw, 864px" /><figcaption>Blueprint scripting for the first level</figcaption></figure>



<figure class="wp-block-image"><img decoding="async" width="613" height="313" src="https://couchlearn.com/wp-content/uploads/2019/10/image-19.png" alt="The second level blueprint code containing a print string to show the value of health on the screen" class="wp-image-835" srcset="https://couchlearn.com/wp-content/uploads/2019/10/image-19.png 613w, https://couchlearn.com/wp-content/uploads/2019/10/image-19-416x212.png 416w, https://couchlearn.com/wp-content/uploads/2019/10/image-19-300x153.png 300w" sizes="(max-width: 613px) 100vw, 613px" /><figcaption>Blueprint scripting for the second level</figcaption></figure>



<p>Loading the second level will print out the value of Health from our Game Instance. As this value was set to 50 in the first level the print string node will print the value 50 on the screen.</p>



<figure class="wp-block-image"><img decoding="async" width="528" height="286" src="https://couchlearn.com/wp-content/uploads/2019/10/image-20.png" alt="The value 50 printed on the screen" class="wp-image-836" srcset="https://couchlearn.com/wp-content/uploads/2019/10/image-20.png 528w, https://couchlearn.com/wp-content/uploads/2019/10/image-20-416x225.png 416w, https://couchlearn.com/wp-content/uploads/2019/10/image-20-300x163.png 300w" sizes="(max-width: 528px) 100vw, 528px" /><figcaption>Result of testing the Game Instance</figcaption></figure>



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



<p>Now that you have the knowledge to use the Game Instance in your Unreal Engine 4 game, you can now adapt this to your user interface through the widget system or onto your player character. <br><br>Doing so will give you the ability to switch levels without losing player values such as health, ammo and quest progress. <br><br>Those are only a few examples of what the Game Instance can do but there are many more ways to use saved values.</p>



<h4 class="wp-block-heading">More Complex Uses</h4>



<p>Using Discord Rich Presence in your game can be easily accessed by storing the Discord object in the Game Instance. <br><br><a href="https://couchlearn.com/how-to-use-discord-rich-presence-in-unreal-engine-4/">Click here to learn how to add Discord Rich Presence into your Unreal Engine 4 game.</a></p>
<p>The post <a href="https://couchlearn.com/how-to-use-the-game-instance-in-unreal-engine-4/">How to use the Game Instance 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-the-game-instance-in-unreal-engine-4/feed/</wfw:commentRss>
			<slash:comments>0</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-14 17:53:19 by W3 Total Cache
-->