Unreal Engine C++ Course | ENG
  • About course
  • Links
    • Git
    • Visual Studio
    • Unreal Engine
  • Unreal Editor Hotkeys
  • Visual Studio Hotkeys
  • Console commands
  • Problems and solutions
    • Unable to start program error
  • Lessons
    • Lecture 065
      • Additive animation upon landing
      • Blocking shooting while running
    • Lecture 079
      • Pickup is visible after the ammo has been taken
      • Ammo is not picked up if character spends ammo at the pickup respawn point
    • Lecture 089
      • NiagaraSystem does not attach to muzzle
    • Lecture 148
    • Lecture 155
  • UE5
  • Automation
    • Code formatting
  • Student projects
Powered by GitBook
On this page
  • Install UE5
  • Problem
  • Solution
  • generate_project_files_4.26.bat
  • generate_project_files_5.0.bat
  • clean_intermediate_files.bat
  • include "Camera/CameraShake.h"
  • Summary

Was this helpful?

UE5

PreviousLecture 155NextAutomation

Last updated 3 years ago

Was this helpful?

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.

There is no need to switch to UE5. A very early version. Explore the interface - OK. Visually, only the interface has changed (in fact, the skin). All settings, parameters are in the same places. There will be no problems (at the moment) with the transition to UE5. All our projects are successfully compiled for this version already. The codebase is not affected in this regard. All course code will be valid for UE5 as well.

Additionally, for convenience, you can create an additional script clean_and_gen.bat that removes temporary files and generates project files at the same time, with two lines inside: clean_intermediate_files.bat generate_project_files_4.26.bat

Update repositories. The commits have been added.