Can I cache/disable code property reflection generation per build in UBT/UHT?

I’m trying to speed up my builds for trivial changes and the reflection generation seems to be running and taking time even if the underlying files haven’t changed at all.

For example, in this build where nothing at all changed (for worst-case illustration purposes) it takes a big chunk of the build time (over 50%):

1>------ Build started: Project: ProjectName, Configuration: Development_Editor x64 ------
1>Log file: <path>\Engine\Programs\UnrealBuildTool\Log.txt
1>Parsing headers for ProjectNameEditor
1>  Running UnrealHeaderTool "<path>\ProjectName\ProjectName.uproject" "<path>\ProjectName\Intermediate\Build\Win64\ProjectNameEditor\Development\ProjectNameEditor.uhtmanifest" -LogCmds="loginit warning, logexit warning, logdatabase error" -Unattended -WarningsAsErrors -abslog="<path>\Engine\Programs\UnrealBuildTool\Log_UHT.txt"
1>Reflection code generated for ProjectNameEditor in 2.1976108 seconds
1>Target is up to date
1>Total execution time: 4.12 seconds
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

Is there any way to either:

  • Explicitly tell it not to attempt to recalculate reflections this build, or
  • To cache the reflection code so it quickly notices that nothing has changed?

Obviously in a real case something would have changed, but 99% of the time it’s something that doesn’t affect reflection at all, but I’m still paying that overhead on every single compile.

This is a VS2019 build on a windows machine.

Turns out if you hack UBT then yes, you can have this flag.

Can u share your solution please?