<?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>ue4 switch on Archives - Couch Learn</title>
	<atom:link href="https://couchlearn.com/tag/ue4-switch-on/feed/" rel="self" type="application/rss+xml" />
	<link>https://couchlearn.com/tag/ue4-switch-on/</link>
	<description>Detailed Game Programming Tutorials</description>
	<lastBuildDate>Sat, 25 Jan 2025 17:33:53 +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>ue4 switch on Archives - Couch Learn</title>
	<link>https://couchlearn.com/tag/ue4-switch-on/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<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 fetchpriority="high" 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>
	</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-05 21:08:21 by W3 Total Cache
-->