It looks like nothing is easy in gamedev, so here is my notes how to get started developing C++ module for Unreal engine on Mac without downloading 100GiB of files and or losing your sanity in the process.
Directory where you clone unreal source code will be referenced in snippets below as $udir
.
udir=~/Documents/UnrealEngine
git clone --depth=1 -b 5.0.2-release https://github.com/EpicGames/UnrealEngine $udir
Save .gitdepsignore from this gist to $udir
. Then from $udir
./Setup.sh
./GenerateProjectFiles.sh -CurrentPlatform
Your uproject need to have "EngineAssociation": "AAAAAAAA-BBBB-CCCC-DDDD-000011112222"
(you can use any UUID or maybe
even any string). With EngineAssociation
can't just be a filesystem path is beyond me.
UUID is looked up in ~/Library/Application\ Support/Epic/UnrealEngine/Install.ini
, so we need to add our $udir there.
Once done, it shoud look something like (use value $udir
is pointing to, not literal $udir
)
cat ~/Library/Application\ Support/Epic/UnrealEngine/Install.ini
[Installations]
AAAAAAAA-BBBB-CCCC-DDDD-000011112222=$udir
Once "registered", add top level key "EngineAssociation": "AAAAAAAA-BBBB-CCCC-DDDD-000011112222"
to your uproject.
Because XCode is for Martians, you might want to use Rider. For that install Mono and Dotnet plugins
(no idea which is actually used, having both wont hurt I geuss) and open uproject file directly.
You MUST have at least one .Target.cs
file with Type = TargetType.Game;
otherwise Rider fails with unhelpful error.
Add module you want to develop in Rider to the .Target.cs
, here is how it might look:
using UnrealBuildTool;
public class dummyTarget : TargetRules
{
public dummyTarget( TargetInfo Target) : base(Target)
{
Type = TargetType.Game;
DefaultBuildSettings = BuildSettingsVersion.V2;
ExtraModuleNames.Add("MyModule");
}
}
You MUST have Source/MyModule/MyModule.build.cs
with public class MyModule : ModuleRules
, otherwise Unreal build tool
will not cooperate. You then place your source in the Source/MyModule/{Private,Public}
directories. No need to mention them
in your module's .build.cs
, they are found by UnrealBuildTool automagically.