Hello,
A few notes about my environment:
- Platform: macOS
- Using Unreal 5.4
- Compiled engine from source
Context for this question:
I’m trying to iterate quickly on macOS. Hotreloading C++ on macOS takes around 15 sections, so I’m moving code into Plugins so I can build the plugins independently.
I’ve tried a few techniques to compile plugins quickly:
1) Go into the “Modules” panel, and click “Recompile” on my plugin
This still takes around 15 seconds. I added some logs to the UnrealBuildTool
program, and it’s actually checking all my source files, including engine files, so I get no speedup compiling my plugin individually.
The compilation step is super fast, but UnrealBuildTool does like 10 seconds of preparation just to say “the only code that’s changed is in your plugin”.
2) I tried extracting the Xcode / clang++ commands and running them independently
For example, when I add logs to UnrealBuildTool
, I see a bunch of commands like:
<path>XcodeDefault.xctoolchain/usr/bin/clang++ @"<path>/ProjectName/Plugins/MY_PLUGIN/Intermediate/Build/Mac/arm64/UnrealEditor/Development/MY_PLUGIN/MySubsystem.cpp.o.rsp"
So I tried copying those commands into a script, got all my paths right, but it still doesn’t work because it can’t find the Unreal headers (eg. "include “CoreMinimal.h”).
3) Package the plugin and build it separately
I am following this guide to package a Plugin: Building Plugins | Community tutorial
When I run the recommended commands, it recompiles the whole editor, even with the NoCompileEditor
flag. This is really bad for my workflow, as this takes hours. In addition, when I go to run my editor again, I have to do another full recompilation of the editor.
Engine/Build/BatchFiles/RunUAT.sh BuildPlugin \
-plugin="$SCRIPT_DIR/PLUGIN_NAME.uplugin" \
-package="$SCRIPT_DIR/Packaged" \
-TargetPlatforms=Mac \
-NoCompileEditor
So I have 3 questions:
- How do I prevent build commands from deleting my built engine cache
- How do I package plugins on macOS?
- Most importantly: How do I build C++ changes quickly on macOS? It should take around 3 seconds if I’m not adding or removing files, but UnrealBuildTool and AutomationTool are spending around 15 seconds preparing the world.