I have fixed the problem and hope this helps others in the future.
Compile time has been reduced from 20 minutes to just 1–2 minutes.
Edit:
1.<PROJECT_DIR>\Saved\UnrealBuildTool\BuildConfiguration.xml
<?xml version="1.0" encoding="utf-8" ?>
<Configuration xmlns="https://www.unrealengine.com/BuildConfiguration">
<BuildConfiguration>
<bAllowUBAExecutor>false</bAllowUBAExecutor>
</BuildConfiguration>
</Configuration>
By the way,I also tried changing only the WindowsSdkVersion, but it didn’t help.
<?xml version="1.0" encoding="utf-8" ?>
<Configuration xmlns="https://www.unrealengine.com/BuildConfiguration"><WindowsPlatform>
<WindowsSdkVersion>10.0.22621.0</WindowsSdkVersion>
</WindowsPlatform>
</Configuration>
And earlier, I also tried adding the configuration to
%APPDATA%\Unreal Engine\UnrealBuildTool\BuildConfiguration.xml, but that didn’t work either.
In the end, the following attempts did NOT work:
-
Modifying %APPDATA%\Unreal Engine\UnrealBuildTool\BuildConfiguration.xml
-
Changing the WindowsSdkVersion 10.0.22621.0
-
Adding the engine path and project path to the Windows antivirus whitelist
-
Verifying engine installation and Visual Studio2022
-
Rebuilding project files manually from
.uproject -
Running UE and Visual Studio as administrator
Thx to everyone above for the helpful replies.