Skip to content

Instantly share code, notes, and snippets.

@DryreL
Last active August 29, 2025 20:37
Show Gist options
  • Save DryreL/0cec98640a56baa9019e7f4eb8079a96 to your computer and use it in GitHub Desktop.
Save DryreL/0cec98640a56baa9019e7f4eb8079a96 to your computer and use it in GitHub Desktop.
Unreal Engine Build Generator - A compact and automated build script for Unreal Engine projects that supports multiple platforms and build configurations. This script automatically detects project directories, Unreal Engine installations, and desktop locations.
@echo off
setlocal enabledelayedexpansion
:: ========================================
:: CONFIGURATION - Edit these variables
:: ========================================
set "PROJECT_NAME=Darkisher"
set "UE_VERSION=5.6"
set "UE_PATH=D:\Program Files\Epic Games\UE_5.6"
:: ========================================
echo ========================================
echo Unreal Engine - %PROJECT_NAME% - Build Generator
echo ========================================
echo.
echo Created by DryreL - https://github.com/DryreL
echo Downloaded from: https://gist.github.com/DryreL/0cec98640a56baa9019e7f4eb8079a96
echo.
:: Auto-detect project directory (improved method)
set "SCRIPT_DIR=%~dp0"
set "PROJECT_DIR=%SCRIPT_DIR:~0,-6%"
echo Project Directory: %PROJECT_DIR%
:: Verify project file exists
if not exist "%PROJECT_DIR%\%PROJECT_NAME%.uproject" (
echo ERROR: %PROJECT_NAME%.uproject not found at: %PROJECT_DIR%
echo Please make sure this script is in the Build folder of the project.
echo.
echo Press any key to exit...
pause >nul
exit /b 1
)
:: Auto-detect Desktop
for /f "tokens=2*" %%a in ('reg query "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v Desktop 2^>nul') do set "DESKTOP=%%b"
if not defined DESKTOP set "DESKTOP=%USERPROFILE%\Desktop"
echo Desktop Directory: %DESKTOP%
:: Verify Unreal Engine installation
echo Verifying Unreal Engine installation at: %UE_PATH%
if not exist "%UE_PATH%\Engine\Binaries\Win64\UnrealEditor.exe" (
echo ERROR: UnrealEditor.exe not found at: %UE_PATH%\Engine\Binaries\Win64\UnrealEditor.exe
echo Please check the UE_PATH variable in this script.
echo.
echo Press any key to exit...
pause >nul
exit /b 1
)
:: Verify UE installation
if not exist "%UE_PATH%\Engine\Build\BatchFiles\RunUAT.bat" (
echo ERROR: RunUAT.bat not found at: %UE_PATH%\Engine\Build\BatchFiles\RunUAT.bat
echo Unreal Engine installation may be incomplete.
echo.
echo Press any key to exit...
pause >nul
exit /b 1
)
echo UE installation verified successfully.
echo.
echo ========================================
echo Platform Selection
echo ========================================
echo Available platforms:
echo 0: Windows
echo 1: TVOS
echo 2: Mac
echo 3: Linux
echo 4: iOS
echo 5: Android
echo.
:platform_selection
set /p "PLATFORM_INDEX=Enter platform index (0-5): "
if "%PLATFORM_INDEX%"=="0" (
set "PLATFORM=Win64"
set "PLATFORM_NAME=Windows"
set "TARGET_PLATFORM="
goto config_selection
) else if "%PLATFORM_INDEX%"=="1" (
set "PLATFORM=TVOS"
set "PLATFORM_NAME=TVOS"
set "TARGET_PLATFORM="
goto config_selection
) else if "%PLATFORM_INDEX%"=="2" (
set "PLATFORM=Mac"
set "PLATFORM_NAME=Mac"
set "TARGET_PLATFORM="
goto config_selection
) else if "%PLATFORM_INDEX%"=="3" (
set "PLATFORM=Linux"
set "PLATFORM_NAME=Linux"
set "TARGET_PLATFORM="
goto config_selection
) else if "%PLATFORM_INDEX%"=="4" (
set "PLATFORM=IOS"
set "PLATFORM_NAME=iOS"
set "TARGET_PLATFORM="
goto config_selection
) else if "%PLATFORM_INDEX%"=="5" (
set "PLATFORM=Android"
set "PLATFORM_NAME=Android"
set "TARGET_PLATFORM=-targetplatform=Android"
goto config_selection
) else (
echo Invalid platform index. Please enter a number between 0-5.
goto platform_selection
)
:config_selection
echo.
echo ========================================
echo Build Configuration Selection
echo ========================================
echo Available configurations:
echo 0: Debug
echo 1: DebugGame
echo 2: Development
echo 3: Test
echo 4: Shipping
echo.
set /p "CONFIG_INDEX=Enter configuration index (0-4): "
if "%CONFIG_INDEX%"=="0" (
set "CONFIG=Debug"
goto build_start
) else if "%CONFIG_INDEX%"=="1" (
set "CONFIG=DebugGame"
goto build_start
) else if "%CONFIG_INDEX%"=="2" (
set "CONFIG=Development"
goto build_start
) else if "%CONFIG_INDEX%"=="3" (
set "CONFIG=Test"
goto build_start
) else if "%CONFIG_INDEX%"=="4" (
set "CONFIG=Shipping"
goto build_start
) else (
echo Invalid configuration index. Please enter a number between 0-4.
goto config_selection
)
:build_start
:: Set output directory
set "OUTPUT_DIR=%DESKTOP%\%PROJECT_NAME%_%CONFIG%_%PLATFORM_NAME%"
echo.
echo ========================================
echo Build Configuration:
echo ========================================
echo Project: %PROJECT_DIR%
echo UE Path: %UE_PATH%
echo Platform: %PLATFORM_NAME% (%PLATFORM%)
echo Configuration: %CONFIG%
echo Output: %OUTPUT_DIR%
echo ========================================
echo.
:: Check for Android SDK if Android is selected
if "%PLATFORM%"=="Android" (
if not exist "%ANDROID_HOME%" (
echo WARNING: ANDROID_HOME environment variable not set.
echo Android SDK path not found. Build may fail.
echo Please set ANDROID_HOME to your Android SDK path.
echo.
)
)
:: Check for Mac/iOS builds
if "%PLATFORM%"=="Mac" (
echo WARNING: Mac builds require a Mac with Xcode installed.
echo This will create project files for Mac to build.
echo You need to transfer the project to a Mac and build there.
echo.
) else if "%PLATFORM%"=="IOS" (
echo WARNING: iOS builds require a Mac with Xcode installed.
echo This will create project files for Mac to build.
echo You need to transfer the project to a Mac and build there.
echo.
)
:: Clean previous build
if exist "%OUTPUT_DIR%" (
echo Cleaning previous build...
rmdir /s /q "%OUTPUT_DIR%"
)
:: Run the build
echo Starting build process...
echo This may take several minutes...
"%UE_PATH%\Engine\Build\BatchFiles\RunUAT.bat" BuildCookRun -project="%PROJECT_DIR%\%PROJECT_NAME%.uproject" -noP4 -platform=%PLATFORM% -clientconfig=%CONFIG% -serverconfig=%CONFIG% -cook -allmaps -build -stage -pak -archive -archivedirectory="%OUTPUT_DIR%" %TARGET_PLATFORM%
if %ERRORLEVEL% equ 0 (
echo.
echo ========================================
echo [92mBUILD SUCCESSFUL![0m
echo ========================================
echo Output location: %OUTPUT_DIR%
echo.
if "%PLATFORM%"=="Mac" (
echo Next steps:
echo 1. Transfer the project to a Mac
echo 2. Open the .xcworkspace file in Xcode
echo 3. Build and run on Mac
echo.
) else if "%PLATFORM%"=="IOS" (
echo Next steps:
echo 1. Transfer the project to a Mac
echo 2. Open the .xcworkspace file in Xcode
echo 3. Build and deploy to iOS device
echo.
) else (
echo Opening output directory...
explorer "%OUTPUT_DIR%"
)
echo.
echo [92mBuild completed successfully! Press any key to exit...[0m
pause >nul
) else (
echo.
echo ========================================
echo [91mBUILD FAILED![0m
echo ========================================
echo Check the error messages above.
echo.
if "%PLATFORM%"=="Android" (
echo Common Android build issues:
echo 1. Android SDK not installed or ANDROID_HOME not set
echo 2. Java JDK not installed or JAVA_HOME not set
echo 3. Android NDK not installed
echo 4. Android SDK Build Tools not installed
echo.
)
echo [91mBuild failed! The command window will stay open so you can read the error log.[0m
echo [91mPress any key to close this window...[0m
pause >nul
)
@DryreL
Copy link
Author

DryreL commented Aug 29, 2025

Hi! I'm DryreL.

I’ve prepared a .bat script file to help you build.

Simply right-click the .bat file, select Edit, and manually enter the UE path and uproject name.

If you receive an error during the build, the command prompt will wait before closing so you can read the error.

1) EDIT THE FOLLOWING VALUES:

image

2) BAT LOCATION

Make sure to put this .bat file into your {ProjectDirectory}/Build folder.

image

PREVIEW IMAGE:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment