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

<channel>
	<title>ue5 basics Archives - Couch Learn</title>
	<atom:link href="https://couchlearn.com/tag/ue5-basics/feed/" rel="self" type="application/rss+xml" />
	<link>https://couchlearn.com/tag/ue5-basics/</link>
	<description>Detailed Game Programming Tutorials</description>
	<lastBuildDate>Sat, 25 Jan 2025 17:13:37 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.5</generator>

<image>
	<url>https://couchlearn.com/wp-content/uploads/2020/05/cropped-logolarge-32x32.png</url>
	<title>ue5 basics Archives - Couch Learn</title>
	<link>https://couchlearn.com/tag/ue5-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>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/

Page Caching using Disk: Enhanced 
Minified using Disk

Served from: couchlearn.com @ 2026-04-07 00:49:28 by W3 Total Cache
-->