{"id":935,"date":"2022-05-09T19:17:35","date_gmt":"2022-05-09T10:17:35","guid":{"rendered":"https:\/\/colory-games.net\/site\/?p=935"},"modified":"2023-11-04T20:51:13","modified_gmt":"2023-11-04T11:51:13","slug":"build-the-unreal-engine-from-source-code-en","status":"publish","type":"post","link":"https:\/\/colory-games.net\/site\/en\/build-the-unreal-engine-from-source-code-en\/","title":{"rendered":"Build the Unreal Engine from Source Code"},"content":{"rendered":"\n<div class=\"wp-block-jetpack-markdown\"><p>You can build the Unreal Engine from source code released under <a href=\"https:\/\/www.unrealengine.com\/ja\/ue4-on-github\">some restrictions<\/a>.<br>\nUsing an unreleased Unreal Engine will face you the unforeseen issues.\nHowever, there are advantages to using an unreleased Unreal Engine.<br>\nFor example, you can use unreleased features, and apply patches for critical bug fixes.<\/p>\n<p>This article explains how to build the Unreal Engine from source code and how to use the built Unreal Engine.<br>\nThis article also explains how to debug the Unreal Engine.<\/p>\n<div id=\"toc_container\" class=\"no_bullets\"><p class=\"toc_title\">\u76ee\u6b21<\/p><ul class=\"toc_list\"><li><a href=\"#Prerequisites\">Prerequisites<\/a><\/li><li><a href=\"#How_to_build_the_Unreal_Engine\">How to build the Unreal Engine<\/a><ul><li><a href=\"#1_Download_the_Unrael_Engine_source_code\">1. Download the Unrael Engine source code<\/a><\/li><li><a href=\"#2_Download_the_dependent_files\">2. Download the dependent files<\/a><\/li><li><a href=\"#3_Create_a_Visual_Studio_project_file_to_build_the_Unreal_Engine\">3. Create a Visual Studio project file to build the Unreal Engine<\/a><\/li><li><a href=\"#4_Configure_the_build_configuration\">4. Configure the build configuration<\/a><\/li><li><a href=\"#5_Build\">5. Build<\/a><\/li><li><a href=\"#6_Run\">6. Run<\/a><\/li><\/ul><\/li><li><a href=\"#How_to_debug_Unreal_Engine\">How to debug Unreal Engine<\/a><ul><li><a href=\"#1_Preparation\">1. Preparation<\/a><\/li><li><a href=\"#2_Debug_execution\">2. Debug execution<\/a><\/li><li><a href=\"#3_Set_breakpoints\">3. Set breakpoints<\/a><\/li><\/ul><\/li><li><a href=\"#References\">References<\/a><\/li><\/ul><\/div>\n<h1><span id=\"Prerequisites\">Prerequisites<\/span><\/h1>\n<p>The procedure for building the Unreal Engine depends on the environment.<\/p>\n<ul>\n<li>OS\n<ul>\n<li>Windows 10<\/li>\n<\/ul>\n<\/li>\n<li>Software\n<ul>\n<li><a href=\"https:\/\/visualstudio.microsoft.com\/ja\/downloads\/\">Visual Studio 2019<\/a><\/li>\n<li><a href=\"https:\/\/gitforwindows.org\/\">Git for Windows<\/a><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h1><span id=\"How_to_build_the_Unreal_Engine\">How to build the Unreal Engine<\/span><\/h1>\n<p>To build the Unreal Engine, follow these steps.<\/p>\n<ol>\n<li>Download the Unreal Engine source code<\/li>\n<li>Download the dependency files<\/li>\n<li>Create a Visual Studio project file to build the Unreal Engine<\/li>\n<li>Configure the build configuration<\/li>\n<li>Build<\/li>\n<li>Run<\/li>\n<\/ol>\n<h2><span id=\"1_Download_the_Unrael_Engine_source_code\">1. Download the Unrael Engine source code<\/span><\/h2>\n<p>Download the Unreal Engine source code from GitHub.<br>\nTo download the source code, you must have permission to access the Unreal Engine source code.<br>\nPlease refer to <a href=\"https:\/\/www.unrealengine.com\/ja\/ue4-on-githu\">Documentation<\/a> to obtain access permissions in advance.<\/p>\n<pre><code class=\"language-bash\">git clone https:\/\/github.com\/EpicGames\/UnrealEngine.git\ncd UnrealEngine\n<\/code><\/pre>\n<p>Switch to the source code you wish to build.<br>\nTags are created for each version of the Unreal Engine released.\nSpecify the tag corresponding to the version you wish to build.<br>\nTo build version 5.0.0 of the Unreal Engine, execute the following command.<\/p>\n<pre><code class=\"language-bash\">git checkout 5.0.0-release\n<\/code><\/pre>\n<p>To switch to the latest source code, execute the following command.<\/p>\n<pre><code class=\"language-bash\">git checkout ue5-main\n<\/code><\/pre>\n<h3>Cautions<\/h3>\n<p>When you place Unreal Engine source code in a <strong>DEEP<\/strong> directory, it may exceed the Windows absolute path length limit (256 characters) at build time and fail the build.<br>\nTry to download the source code in a directory with a shorter absolute path length.<\/p>\n<p><code>.suppressed.exp<\/code> files, which are intermediate files created at build time, tend to have longer path lengths.<br>\nIf the path length limit is exceeded, the file can not be opened and an error will occur.<br>\nFor example, <code>UnrealEditor-VisualStudioCodeSourceCodeAccess.lib.response<\/code> has 200 characters path length at least from the top repository.<\/p>\n<pre><code>\/Engine\/Plugins\/Developer\/VisualStudioCodeSourceCodeAccess\/Intermediate\/Build\/Win64\/UnrealEditor\/\nDevelopment\/VisualStudioCodeSourceCodeAccess\/UnrealEditor-VisualStudioCodeSourceCodeAccess.lib.response\n<\/code><\/pre>\n<h2><span id=\"2_Download_the_dependent_files\">2. Download the dependent files<\/span><\/h2>\n<p>The obtained source code will be placed in the directory <code>UnrealEngine<\/code>.<br>\nIn the directory <code>UnrealEngine<\/code>, you will find a bat file <code>Setup.bat<\/code> that downloads the dependency files to build Unreal Engine.<br>\nDouble-click <code>Setup.bat<\/code> to download the dependency files.<\/p>\n<h2><span id=\"3_Create_a_Visual_Studio_project_file_to_build_the_Unreal_Engine\">3. Create a Visual Studio project file to build the Unreal Engine<\/span><\/h2>\n<p>Use Visual Studio to build Unreal Engine.<br>\nIn the directory <code>UnrealEngine<\/code>, you will find a bat file <code>GenerateProjectFiles.bat<\/code> that creates the Visual Studio project files to build the Unreal Engine.<br>\nDouble-click <code>GenerateProjectFiles.bat<\/code> to create the Visual Studio project files.<br>\nAfter this, the Visual Studio project file <code>UE5.sln<\/code> will be generated in the directory <code>UnrealEngine<\/code>.<\/p>\n<h2><span id=\"4_Configure_the_build_configuration\">4. Configure the build configuration<\/span><\/h2>\n<p>Double-click the generated Visual Studio project file <code>UE5.sln<\/code> to start Visual Studio.<br>\nOnce Visual Studio is launched, configure the build configuration.<\/p>\n<ul>\n<li>Find the project [UE5] in the [Solution Explorer], right-click it and execute [Set as StartUp Project]<\/li>\n<li>Change [Solution Configuration] to [Development Editor] at the top of the screen<\/li>\n<li>Change [Solution Platform] to [Win64] at the top of the screen<\/li>\n<\/ul>\n<p><a href=\"https:\/\/i0.wp.com\/colory-games.net\/site\/wp-content\/uploads\/tech-blog\/nutti\/2022\/05\/20220509\/build_configuration.png?ssl=1\"><img decoding=\"async\" src=\"https:\/\/i0.wp.com\/colory-games.net\/site\/wp-content\/uploads\/tech-blog\/nutti\/2022\/05\/20220509\/build_configuration.png?ssl=1\" alt=\"Build Configuration\" data-recalc-dims=\"1\"><\/a><\/p>\n<h2><span id=\"5_Build\">5. Build<\/span><\/h2>\n<p>From the menu, run [Build] &gt; [Build Solution] to build Unreal Engine 5.<\/p>\n<h2><span id=\"6_Run\">6. Run<\/span><\/h2>\n<p>Once the build is complete, run the Unreal Engine.<br>\nThere are two ways to run it.<\/p>\n<ul>\n<li>Execute [Debug] &gt; [Start Without Debugging] from the menu<\/li>\n<li>Run from the executable file <code>UnraelEditor.exe<\/code> in the path <code>\/Engine\/Binaries\/Win64<\/code><\/li>\n<\/ul>\n<h1><span id=\"How_to_debug_Unreal_Engine\">How to debug Unreal Engine<\/span><\/h1>\n<p>This section describes how to debug builds of Unreal Engine and how to actually debug them.<\/p>\n<h2><span id=\"1_Preparation\">1. Preparation<\/span><\/h2>\n<p>Build the Unreal Engine by referring to the Unreal Engine build instructions.<br>\nThere is no need to change any build settings.<\/p>\n<h2><span id=\"2_Debug_execution\">2. Debug execution<\/span><\/h2>\n<p>Run the Unreal Engine for debugging.<br>\nYou can run the built Unreal Engine from the Visual Studio menu, but you cannot debug it because a different process will be launched.<br>\nSo, run the Unreal Engine beforehand and attach the process after it was launched.<\/p>\n<ol>\n<li>Run the executable file <code>UnraelEditor.exe<\/code> in the path <code>\/Engine\/Binaries\/Win64<\/code><\/li>\n<li>Open your Unreal Engine project<\/li>\n<li>From the Visual Studio menu, run [Debug] &gt; [Attach to Process&#8230;]<\/li>\n<li>Select the process <code>UnrealEditor.exe<\/code> that was launched when you opened the Unreal Engine project<\/li>\n<\/ol>\n<p><a href=\"https:\/\/i0.wp.com\/colory-games.net\/site\/wp-content\/uploads\/tech-blog\/nutti\/2022\/05\/20220509\/attach_to_process.png?ssl=1\"><img decoding=\"async\" src=\"https:\/\/i0.wp.com\/colory-games.net\/site\/wp-content\/uploads\/tech-blog\/nutti\/2022\/05\/20220509\/attach_to_process.png?ssl=1\" alt=\"Attach to Process\" data-recalc-dims=\"1\"><\/a><\/p>\n<h2><span id=\"3_Set_breakpoints\">3. Set breakpoints<\/span><\/h2>\n<p>At this stage, the environment is ready for debugging and execution, so let&#8217;s set a breakpoint in the library function <code>UKismetSystemLibrary::PrintString<\/code> (Same as <code>Print String<\/code> node on the blueprint).<br>\nThe source file of the library function <code>UKismetSystemLibrary::PrintString<\/code> is located in the path <code>\/Engine\/Source\/Runtime\/Engine\/Private\/KismetSystemLibrary.cpp<\/code>.<br>\nOpen the source file in Visual Studio, find the library function definition <code>UKismetSystemLibrary::PrintString<\/code> and add a breakpoint on the first line.<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/colory-games.net\/site\/wp-content\/uploads\/tech-blog\/nutti\/2022\/05\/20220509\/set_break_point.png?ssl=1\"><img decoding=\"async\" src=\"https:\/\/i0.wp.com\/colory-games.net\/site\/wp-content\/uploads\/tech-blog\/nutti\/2022\/05\/20220509\/set_break_point.png?ssl=1\" alt=\"Set Breakpoint\" data-recalc-dims=\"1\"><\/a><\/p>\n<p>Create a new Actor in the editor and connect a <code>Print String<\/code> node to the end of the <code>Event Tick<\/code>.<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/colory-games.net\/site\/wp-content\/uploads\/tech-blog\/nutti\/2022\/05\/20220509\/implement_actor.png?ssl=1\"><img decoding=\"async\" src=\"https:\/\/i0.wp.com\/colory-games.net\/site\/wp-content\/uploads\/tech-blog\/nutti\/2022\/05\/20220509\/implement_actor.png?ssl=1\" alt=\"Implement Actor\" data-recalc-dims=\"1\"><\/a><\/p>\n<p>Compile the created Actor and place it on the level.<br>\nClick [Play this level in the active level editor viewport] to start gameplay, which will execute the <code>PrintString<\/code> node and stop the program at the breakpoint you set.<br>\nAfter this, you can do the step execution and examine the stack trace, just as you would in normal debugging.<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/colory-games.net\/site\/wp-content\/uploads\/tech-blog\/nutti\/2022\/05\/20220509\/stop_program_on_breakpoint.png?ssl=1\"><img decoding=\"async\" src=\"https:\/\/i0.wp.com\/colory-games.net\/site\/wp-content\/uploads\/tech-blog\/nutti\/2022\/05\/20220509\/stop_program_on_breakpoint.png?ssl=1\" alt=\"Program Stops at Breakpoints\" data-recalc-dims=\"1\"><\/a><\/p>\n<h1><span id=\"References\">References<\/span><\/h1>\n<ul>\n<li><a href=\"https:\/\/docs.unrealengine.com\/4.27\/en-US\/ProductionPipelines\/DevelopmentSetup\/BuildingUnrealEngine\/\">Building Unreal Engine from Source | Unreal Engine Documentation<\/a><\/li>\n<\/ul>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>You can build the Unreal Engine from source code released under [some restrictions](https:\/\/www.unrealengine.com\/ja\/ue4-on-github).<br \/>\nUsing an unreleased Unreal Engine will face you the unforeseen issues.<br \/>\nHowever, there are advantages to using an unreleased Unreal Engine.<br \/>\nFor example, you can use unreleased features, and apply patches for critical bug fixes.<\/p>\n<p>This article explains how to build the Unreal Engine from source code and how to use the built Unreal Engine.<br \/>\nThis article also explains how to debug the Unreal Engine.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"templates\/single-home-techblog.php","format":"standard","meta":{"footnotes":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[71],"tags":[158],"jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/colory-games.net\/site\/wp-json\/wp\/v2\/posts\/935"}],"collection":[{"href":"https:\/\/colory-games.net\/site\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/colory-games.net\/site\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/colory-games.net\/site\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/colory-games.net\/site\/wp-json\/wp\/v2\/comments?post=935"}],"version-history":[{"count":6,"href":"https:\/\/colory-games.net\/site\/wp-json\/wp\/v2\/posts\/935\/revisions"}],"predecessor-version":[{"id":1097,"href":"https:\/\/colory-games.net\/site\/wp-json\/wp\/v2\/posts\/935\/revisions\/1097"}],"wp:attachment":[{"href":"https:\/\/colory-games.net\/site\/wp-json\/wp\/v2\/media?parent=935"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/colory-games.net\/site\/wp-json\/wp\/v2\/categories?post=935"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/colory-games.net\/site\/wp-json\/wp\/v2\/tags?post=935"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}