Generate cpp project Couldn't find UnrealBuildTool

As of 24-Mar-2022, with UE5 Preview 2 installed from the Epic Games launcher to a non-default location (D:\Dev\UE_5.0), this is still a problem.

I was able to fix this, see below for details.

To restate the issue: When trying to clean my project, I was getting an unhelpful error saying something about Error_UBTMissing. It was impossible to clean or rebuild from my code editor. (Using Rider early access in case it matters).

I tracked down the issue to a bug in Engine/Build/BatchFiles/Clean.bat

There is a line there that specifically affects installed builds of UE5 differently than compiled builds. Apparently its intent is to prevent the rebuilding of UE5 itself during the clean(?)

In any case, the goto ReadyToClean statement caused the set UBTPath=... to never be executed and so UBTPath was an undefined variable. Perhaps this is OK when UE5 is installed into the default location(?), but it definitely does NOT work if UE5 is installed to a custom location.

To fix the error, I simply moved this line:

set UBTPath="..\..\Engine\Binaries\DotNET\UnrealBuildTool\UnrealBuildTool.dll"

above this line:

if exist ..\Build\InstalledBuild.txt goto ReadyToClean

After saving Engine/Build/BatchFiles/Clean.bat with the new appropriately assigned UBTPath variable, Clean and Rebuild are now working as expected.

2 Likes