Compile and reload from the command line?

Is it possible to trigger a compile and hot reload from the commandline while the editor is running a project?

I mean basicly doing the as pressing the “compile” button within the editor, but triggered from the outside?

Yes, UE4 use it own code build system called UnrealBuildTool (UBT) which you can call out via command line and yes Visual Studio is only needed for compiler that UBT use and you don’t need to use IDE at all (“Compile” button shows you that)

For IDE or text editor you should use those bat files

\UnrealEngine\Engine\Build\BatchFiles\Build.bat ProjectNameEditor Win64 Debug “X:\Path\To\The\Project\ProjectName.uproject” -waitmutex

\UnrealEngine\Engine\Build\BatchFiles\Rebuild.bat ProjectNameEditor Win64 Debug “X:\Path\To\The\Project\ProjectName.uproject” -waitmutex

\UnrealEngine\Engine\Build\BatchFiles\Clean.bat ProjectNameEditor Win64 Debug “X:\Path\To\The\Project\ProjectName.uproject”

Replace ProjectName with name of your project. You can replace Debug with different build configuration (which you can check in VS the names of other configurations). The “Editor” surrfix triggers editor build, “Server” will build dedicated server only build, “Client” will build without server code, without surrfix will build ordenery build without editor, you can see those configuration in VS too. “UE4Editor” without uproject typed in will trigger engine with editor build, you can also type in any names from “Programs” (without “Editor” ofcorse)directory and UBT will build it.

UBT it self have use same arguments + it bat has extra checks, look up inside of bat to see properly. clean.bat includes -clean argument which triggers cleaning and rebuild.bat simple runs clean.bat and build.bat is sequence

UBT has lot of argument you can use (for example useful -module argument which let you build single module) they not documented as i know, so you need to hunt them from UBT code which lucky it easy to find as they packed up in single place:

https://github.com/EpicGames/UnrealEngine/blob/f794321ffcad597c6232bc706304c0c9b4e154b2/Engine/Source/Programs/UnrealBuildTool/System/UnrealBuildTool.cs#L417

2 Likes

Great answer, just what i wanted to know!
Thank you so much!

Running the build.sh ProjectNameEditor Mac DebugGame command causes the Editor to show a popup “Hot release complete” but doesn’t really reloads the editor for UPROPERTY defined in C++ code. I had to use the Compile button on the editor to get those properties to show up in the blueprints. =( editor version: UE4.22.3