UE5

Install UE5

You need to update EpicGamesLauncher. After update, a new UE5 tab will appear. Next, install UE5 Early Access in the Library tab in the usual way.

Problem

We unable to generate project files because the path to UnrealBuildTool (a special program for UE automation) has changed. Change the version of the engine through the context menu (right-click on the .uproject file):

We get the error:

The same error will occur if we try to generate the project files via the Generate Visual Studio project files menu item.

Solution

I added three .bat files to generate project files in both repositories (GeometrySandbox and ShootThemUp):

devops/generate_project_files.bat
generate_project_files_4.26.bat 
generate_project_files_5.0.bat 

Do not touch the first parent script devops/generate_project_files.bat. This is a parameterized script that changes the project version and generates VS files:

@echo off

rem Set all paths
SET EnginePath=%~1
SET BuildToolRelativePath=%~2
SET VersionSelector=%~3
SET ProjectPath=%CD%\%~4

rem Change engine version
"%VersionSelector%" /switchversionsilent "%ProjectPath%" "%EnginePath%"

rem Generate project files
"%EnginePath%\%BuildToolRelativePath%" -projectfiles -project="%ProjectPath%" -game -progress

Parameters necessary for generating project files for a specific version of the engine are passed to this script. This happens in the corresponding generate_project_files_4.26.bat scripts and generate_project_files_5.0.bat. In fact, they are needed to specialize the parameters of the parent script.

generate_project_files_4.26.bat

@echo off

rem Set all paths
SET EnginePath=c:\Epic Games\UE Binary\UE_4.26
SET BuildToolRelativePath=Engine\Binaries\DotNET\UnrealBuildTool.exe
SET VersionSelector=c:\Program Files (x86)\Epic Games\Launcher\Engine\Binaries\Win64\UnrealVersionSelector.exe
SET ProjectName=ShootThemUp.uproject

devops/generate_project_files.bat "%EnginePath%" "%BuildToolRelativePath%" "%VersionSelector%" "%ProjectName%"

You need to change 2 variables according to the location of the UE on disk: EnginePath, VersionSelector.

generate_project_files_5.0.bat

Same. I draw your attention to BuildToolRelativePath, this path has changed in UE5 and because of this, there is now a problem with generation via the context menu. It has been moved to the UnrealBuildTool subdirectory:

BuildToolRelativePath=Engine\Binaries\DotNET\UnrealBuildTool\UnrealBuildTool.exe

Nevertheless, when this script is called, an error window will be displayed:

This happens because when you switch the version, the project file generator is additionally called. There is nothing wrong with that. We just ignore it and click OK. This cannot be fixed without changing the source of the engine. In addition, after switching the engine version, we independently generate project files with the correct path to UnrealBuildTool.exe

clean_intermediate_files.bat

Additional script for convenience. It cleans up all temporary files and directories.

include "Camera/CameraShake.h"

This header file in the USTUHealthComponent class must be replaced with the base include:

include "Camera/CameraShakeBase.h"

This will not affect 4.xx versions in any way, so this is a general change. Updated this with a separate commit.

Summary

Additionally, the EnginePath, VersionSelector paths can be determined automatically through the Windows register. In this case, this is overengineering, so we indicate them explicitly, there is nothing wrong with that.

The project name ProjectName.uproject can also be determined automatically by the extension.

I will not do a branch for UE5 yet, no changes are required to run projects with it at all.

When changing engine versions, I recommend deleting all temporary files. That is, first call the clean_intermediate_files.bat script and then one of the generation scripts. Remember to close Visual Studio - the sln file is also deleted in this script.

Update repositories. The commits have been added.

Last updated

Was this helpful?