Skip to content

Instantly share code, notes, and snippets.

@redbaron
Last active July 12, 2022 14:34
Show Gist options
  • Save redbaron/91f4a8cb74776f54db91030b116574f3 to your computer and use it in GitHub Desktop.
Save redbaron/91f4a8cb74776f54db91030b116574f3 to your computer and use it in GitHub Desktop.
Unreal on Mac minimal setup
# add this to the root of UE clone as .gitdepsignore to reduce download size
# every line is turned into regex by converting globs (*, **, ?) to a regex ([^/]*, .*, .).
# every line starting with / is prefixed with ^
# every line NOT ending with / has suffix $
ThirdParty/CEF3/
ThirdParty/ICU/
# ThirdParty/Mono/Mac
ThirdParty/PhysX3/
Python*/
ThirdParty/svn/
Win32/
Win64/
Windows/
Android/
/Templates/
/Samples/
/FeaturePacks/
/Engine/Content/
/Engine/Extras/
/Engine/Documentation/
/Engine/Plugins/
/Engine/Source/Programs/Enterprise/
ThirdParty/ShaderConductor/
ThirdParty/FBX/
ThirdParty/mtlpp/
# ThirdParty/Intel/
ThirdParty/WebRTC/
ThirdParty/EOSSDK/
ThirdParty/Vivox/
ThirdParty/GoogleVR/
ThirdParty/glslang/
ThirdParty/FreeType2/

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.

Clone and dependencies download

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

Engine source registration

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.

Jetbrains Rider

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment