We have at one point (around version 5.2) wrote a script which would automate setup and compile of unreal, the benefit was two fold it correctly installed dependencies and automated deployment. This script was heavily inspired at the time by https://vilbeyli.github.io/How\-to\-Setup\-a\-Perforce\-Workflow\-Automate\-Distribute\-UE4\-Builds/ only rewritten in python. One thing that is desirable was the ability of working in ryder/vs and then packaging using the script without it recompiling the whole engine. Around version 5.4 this stopped working and every deploy meant recompiling the whole engine for the deploy and then recompiling once again for it to be usable in an IDE.
Recently we tried rewriting our automation and started using the batch file runUAT included with the engine. Now this did not solve the above mentioned issue and introduced and issue of the engine being always recompiled in its entirety by the batch file.
Therefore i wanted to ask what would be the correct way of compiling the engine for deployment, with it not recompiling everything when not neccassry and with the solution being able to be worked in with and IDE like VS or Rider.
Hi,
I’m not entirely sure I can accurately picture your workflow, but I assume you want to distribute a prebuilt version of the engine to your users (or build machine) so that your artists don’t need to build the engine. You can make an Installed Build and include the platforms you need. There are more information about this here: https://dev.epicgames.com/documentation/en\-us/unreal\-engine/deploying\-unreal\-engine. Let me know if you have more question after going through the doc.
Otherwise, the RunUAT.bat also let you specify -skipbuild and/or -skipcook arguments if you already have the target built. I usually use those arguments when iterating on code or assets after building the target once. But in general UAT and UBT would not rebuild everything if the target is already built locally and up to date, so something in your workflow probably cause that. I would need a high level list of operations you are doing (and possibly the UE command lines to build/cook…).
Regards,
Patrick
Our workflow basically comes down to running this command `Engine\Build\BatchFiles\RunUAT.bat BuildGraph -target=“Make Installed Build Win64” -script=Engine/Build/InstalledEngineBuild.xml -set:HostPlatformOnly=true -set:WithDDC=true -set:GameConfigurations=Development;DebugGame`
And afterwards installing some python packages.
The issue for me is, that when i do this my subsequent build and run from rider rebuilds whole engine. And vice versa when i’ve been working on something and i would like to package it for deployment the compile starts all over again. We managed to atleast solve the issue of it recompiling every time when compiling the installed build which was due to pesky `-clean` which we got from: `https://dev.epicgames.com/documentation/en\-us/unreal\-engine/using\-an\-installed\-build\-of\-unreal\-engine?application\_version\=5\.2\`.
But our team would love to hear from you if we are doing it wrong and would appreciate any advice on how to better our workflow in any capacity.
Hi,
Which ‘clean’ do you mean? I scanned the doc and found this one:
C:\EpicSource\UE_5.0\UnrealEngine-5.0\Engine\Build\BatchFiles\RunUAT.bat BuildGraph -target="Make Installed Build [PLATFORM]" -script="Engine/Build/InstalledEngineBuild.xml" -clean
If this is the clean you are talking about? Normally, you make the install build once… and using -clean in that case should not matter much… but if you are updating the installed build everyday, yeah, you can save some time… but it should not be related to your project? Once you have compiled the ‘Installed Build’ you have a prebuild engine under Engine/Saved/LocalBuilds/ (I think, I deleted my last Installed Build… so I have to make a new one to confirm). Then if you are building your project with the prebuilt engine that was put under LocalBuilds/ you are not calling the BuildGraph script anymore. I would open the UnrealEditor.exe found under the LocalBuilds/ folder (Engine\Saved\LocalBuilds\Engine\Binaries\Win64\UnrealEditor.exe) or use the RunUAT.bat from that folder:
.\Engine\Saved\LocalBuilds\Engine\Build\BatchFiles\RunUAT.bat -BuidCookRun ...
I’m wondering if you are using the prebuild engine vs the source engine… let me know. I’ll rebuild an IB if needed and list the exact steps… but I think you are building your project with the source engine or you are rebuilding the installed build every time depending on your command line.
Regards,
Patrick
Yes that is the clean i meant.
We are not a games company but a vfx company soo our pipeline is a bit different, we are not builing and cooking any games but are working only in editor. For me I often times have our projects opened up not in our installed build but in compiled build (usually via rider) (meaning it is build purely through the solution). Then I sometimes also build an installed version of the engine and distribute it to artist and other people at our company through p4. My issue is then the switching between compiling and running the editor through the ide and making an installed build. This for me always recompiles everything.
As always any questions and suggestions are welcome.
Best regard
Tomáš
Hi,
Ok, now I understand. The -clean is probably there because internally, we make an Installed Build to distribute the engine on the Epic Game Store, so we want to be sure everything is rebuilt just out of precaution/sanity. For us, it doesn’t really matter, this is done on a random build machine (probably overnight), so the previous build state is likely incorrect anyways, so cleaning and rebuilding makes senses. In your case, you can probably remove the -clean from the script. But if you have space, I would suggest keeping two copies of the engine, one to work locally and one to make your installed builds. But removing the -clean should do the trick too.
One thing to consider, if you are not making game and purely using the Editor, I think you can remove all GameConfigurations to be like below:
Engine\Build\BatchFiles\RunUAT.bat BuildGraph -target="Make Installed Build Win64" -script=Engine/Build/InstalledEngineBuild.xml -set:HostPlatformOnly=true -set:WithDDC=true -set:GameConfigurations=""
In my personal notes, I have a version of this command where I have -set:GameConfigurations=“” so unless I made a cut/paste error in the past, it probably works and will prevent to building the game binaries you don’t need. Because even if you are building the Editor, you are not building the game specific static libraries and you don’t link UnrealGame.exe. Consequently, if you modify some engine source code and make a new installed build (even without the -clean), then you are still going to rebuild the outdated binaries for the game targets.
Regards,
Patrick
Hi,
I tried to quickly locate if we fixed the -Clean after 5.2, I suspect it was broken and got fixed, but the ‘clean’ keyword is kind popular in the code base so finding a fix is not quick and it probably not really worth it anyways… If you are really that curious, you can do some Perforce archeology to figure out. Regarding your other issue about header files, I suspect some side effects with precompiled headers and unity build. Both has the effect of implicitly adding includes when compiling your .cpp files. Your plugin .h/.cpp file should always include the .h they need and not rely in a precompiled header or unity build to include the file implicitly. When you compile with the engine vs with the game you might be using a different .pch or a different unity file… and the includes will not be the same.
Otherwise, it can be some other subtility, but I would need more details about the error. Typical case are missing module dependencies or dependencies you should not have (taping into private headers somehow)… but I would not some example of error to help.
Regards,
Patrick
btw the `-clean` still did not solve the issue of the project being recompiled when switching ‘workflow’ from developing in ide vs making installed build. Right now it is not as high of a priority for us to get it working. But I am really curious why it started doing that around 5.3,5.4.
Also there is one more issue thas has come up. there is a difference when we are compiling a plugin which we are developing that contains our tools when we compile it as a part of a project and when we compile it as part of an engine. Usually when compiling as a part of the engine it has more issues with includes and requieres explicit includes which were not needed when compiling the plugin in project. Not sure what causes it.